Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-1198

QDateTime doesn't properly account for DST when converting to UTC on Windows

XMLWordPrintable

      On Windows, when converting from local time to UTC, QDateTime always adds the timezone offset to the current time, without accounting for DST.

      Set a Windows computer to use the Eastern Timezone (GMT -05:00), and then set as the date/time November 4, 01:20 AM; the date/time system dialog will display "Eastern Daylight Time". Now, print the values of currentDateTime() and currentDateTime().toUTC():

      => local: Sun Nov 4 01:20:00 2007
      => utc : Sun Nov 4 06:20:00 2007

      Since DST is currently on, the correct UTC time should be '05:20:00' and not '06:20:00'. Now set the clock to 2:20 AM; the date/time system dialog will display "Eastern Standard Time". The output will be

      => local: Sun Nov 4 02:20:00 2007
      => utc : Sun Nov 4 07:20:00 2007

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Unassigned Unassigned
            admin Administrator
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes