我有一些代码从sqlite数据库读取日期时间,datetime作为字符串返回.当我尝试使用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);
Run Code Online (Sandbox Code Playgroud)