I am trying to convert from a GMT/UTC string like this:
11 Sep 2014 14:31:50 GMT
to UNIX timestamp in Qt (c++).
Here's the code (note that I have removed " GMT" from the first string):
QString l_time = "11 Sep 2014 14:31:50";
QDateTime l_dt = QDateTime::fromString(p_gmt_date, "dd MMM yyyy hh:mm:ss");
uint l_timestamp = l_dt.toTimeSpec(Qt::UTC).toTime_t();
This gives me the result:
l_timestamp = 1410438710
Of course this is wrong and I think it is due to "local" settings (consider I am in Italy).
Verifying on this website I get the correct result:
1410445910
In the same website I can crosscheck that the first result is wrong since it returns:
Thu, 11 Sep 2014 12:31:50 GMT
Does anyone can help me? Thanks.