Reputation: 7
I try to get current time (timestamp) on qt.
myvar1=QDateTime::currentMSecsSinceEpoch();
qDebug()<<myvar1;
In Aplication Output i see strage symbols like | â É etc. I expect 1407112707. So my timestamp is not correct. How to display timestamp on QT correctly?
Upvotes: 0
Views: 1366
Reputation: 4344
Possible reason is that you've declared myvar1
incorrecly. Declare it as quint64
.
quint64 myvar1 = QDateTime::currentMSecsSinceEpoch();
qDebug() << myvar1;
Also you can use QString::number(myvar1);
to get a string representation.
Upvotes: 2