Reputation: 21764
How can I create a fixed time for testing purposes?
I'm thinking something like:
static QDateTime startTime = "2001-02-03 14:55:02"
What would be the correct syntax?
Upvotes: 1
Views: 334
Reputation: 4411
From the Qt docs: http://doc.qt.io/qt-5/qdatetime.html
static QDateTime starttime = QDateTime::fromString("2001-02-03 14:55:02");
might be what you are looking for.
A QDateTime can be parsed from a string using the static member function QDateTime::fromString()
this class function, creates a QDateTime internally, intializes it from parsing the string and returning The QDateTime it created.
Upvotes: 3