[Solved] how to convert QDateTime to GMT Unix Stamp
-
I am trying to convert QDateTime to Unix Time Stamp
QDateTime PubDate = audioFile->GetPublishingdate();
uint UTC_Time = PubDate.toTime_t();
For Today,s date "Mon 22. Sep 00:00:00 2014" I am getting this 1411358400 TimeStamp Generated
if i use this website http://www.epochconverter.com/ to check timestamp it is correct if I select Local Time but I want to generate timestamp according to GMT Time Which is 1411344000 for today's Date. I tried various other things.
I am not getting how to get this time stamp
Thanks for help in advance
-
Hi,
PubDate is using local time. You need to tell it to use UTC (GMT) time before you call toTime_t()
See the "QDateTime documentation":http://qt-project.org/doc/qt-5/qdatetime.html for info about time zones and Qt::TimeSpec