Your input is not what you think it is.
Qt Code:
  1. #include <QCoreApplication>
  2. #include <QDateTime>
  3. #include <QStringList>
  4. #include <QDebug>
  5.  
  6. int main(int argc, char **argv) {
  7. QCoreApplication app(argc, argv);
  8.  
  9. // Mimics your reading via std::string
  10. std::string str("2013-10-14 23:59:59,some,other,stuff");
  11. QString row = QString::fromLocal8Bit(str.c_str());
  12. QStringList rowVec = row.split(",");
  13. QString timestamp = rowVec.at(0);
  14. QDateTime timestampH = QDateTime::fromString(timestamp,"yyyy-MM-dd HH:mm:ss");
  15. timestampH.setTimeSpec(Qt::UTC);
  16. qDebug() << timestampH << timestampH.toString(Qt::ISODate) << timestampH.isNull();
  17.  
  18. return 0;
  19. }
To copy to clipboard, switch view to plain text mode 
Output:
Qt Code:
  1. QDateTime("Mon Oct 14 23:59:59 2013") "2013-10-14T23:59:59Z" false
To copy to clipboard, switch view to plain text mode