Force QDateTime.toString() to display UTC time
Solved
General and Desktop
-
How do I force QDateTime.toString () to display UTC time?
If I change the time zone on my computer, then the output of the function also changes. It's pretty obvious, so I added setTimeSpec(Qt::UTC) but it still doesn't work!
I think I am using this incorrectly?
How can I force toString to output timestamp exclusively in UTC format without being bound to the local machine time zone?This code:
Output:
This code:
Output:
-
As stated in the documentation you need to use QDateTime::toUTC().