Reputation: 326
I want to read and display a timestamp in mseconds since epoch , which was send from a client application. My code looks like this:
QDateTime timestamp;
timestamp.fromMSecsSinceEpoch(dataBody.timeStamp);
out << "Time Stamp:" + timestamp.toString(Qt::SystemLocaleShortDate) + "\n";
However, the output is "Time Stamp:", and system says that timestamp is invalid. What is wrong with my code?
Upvotes: 0
Views: 1031
Reputation: 40492
Your code shouldn't even compile because QDateTime::fromMSecsSinceEpoch
is a static function. Correct usage:
QDateTime timestamp = QDateTime::fromMSecsSinceEpoch(dataBody.timeStamp);
Upvotes: 1