Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-26038 Make Date/Time adhere to ISO 8601
  3. QTBUG-18290

QDateTime::toString loses GMT offset for Qt::OffsetFromUTC QDateTime

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Fix Version/s: 4.8.0
    • Component/s: Core: Date/Time
    • Labels:
      None
    • Environment:

      Scratchbox/Harmattan

    • Commits:
      d9e0c2ea4d64b8fdfb31b28e71373735be38101b 3d4149afe62b4fc5d519a2a155b8f8c32e7e95c4 8f95a19d330480bd86650c3d2e4e147d3bca5789

      Description

      Sample program:

      #include <QDebug>
      #include <QDateTime>
      
      int main(int argc, char *argv[])
      {
          QDateTime dt = QDateTime::fromString("1978-11-09T00:00:00+04:00", Qt::ISODate);
          qDebug() << dt << (dt.timeSpec() == Qt::OffsetFromUTC);
          qDebug() << dt.toString(Qt::ISODate);
      
          return 0;
      }
      

      Output:
      QDateTime("Thu Nov 9 00:00:00 1978") true
      "1978-11-09T00:00:00"

      So the +04:00 offset is lost. This seems to be related to the missing "Z" for UTC times mentioned in http://bugreports.qt.nokia.com/browse/QTBUG-9698.

      This makes some synchronisation use-cases for qtcontacts-tracker really painful.

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              albisser Zeno Albisser
              Reporter:
              jensg Jens Georg
              Votes:
              3 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes