【发布时间】:2012-01-19 14:42:34
【问题描述】:
我有一些从 sqlite 数据库中读取日期时间的代码,日期时间作为字符串返回。当我尝试使用 QDateTime::FromString 将其转换为日期时,它返回无效日期。以下是从数据库和转换返回的时间。 为什么这无法解析?
// -this is the value returned from the DB currentServerTime=2012-01-17 19:20:27.0
QString format("yyyy/MM/dd hh:mm:ss");
QString qCurrentServerTime(currentServerTime);
now = QDateTime::fromString(qCurrentServerTime, format);
【问题讨论】: