QDateTime Question
-
If I do something like this:
QDateTime dt;
QString updatedTime = NULL;dt.setSecsSinceEpoch(0); //zero seconds
updatedTime = dt.toString("yyyy-MM-dd hh:mm:ss");I would expect to get "1970-01-01-12:00.00" but instead I get "1969-12-31 19:00:00". It seems there is an offset that I'm missing.
Can someone tell me why?
Thanks
-
If I do something like this:
QDateTime dt;
QString updatedTime = NULL;dt.setSecsSinceEpoch(0); //zero seconds
updatedTime = dt.toString("yyyy-MM-dd hh:mm:ss");I would expect to get "1970-01-01-12:00.00" but instead I get "1969-12-31 19:00:00". It seems there is an offset that I'm missing.
Can someone tell me why?
Thanks
@leinad said in QDateTime Question:
It seems there is an offset that I'm missing.
Local time (which is what
DateTime::toString()outputs)? What timezone are you in?? USA EST (UTC -5 hours) perchance? :)Perhaps you are looking to use QDateTime QDateTime::toUTC() const ? See the example code there, and also int QDateTime::offsetFromUtc() const.