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

QDateTime in utc converted to string from QVariant are not restored correctly

    XMLWordPrintable

Details

    • Sub-task
    • Resolution: Invalid
    • Not Evaluated
    • 5.2.0
    • Core: Date/Time
    • None
    • Kubuntu quantal 64bits up to date

    • 15da0a5af20fe6771bcb94ef8d46edbd5c8fb64c

    Description

      QDateTime in utc converted to string within QVariant, then converted from QVariant string to datetime loose utc.

      #include <QtCore>
      
      int main(int argc, char *argv[])
      {
          QCoreApplication a(argc, argv);
      
          const QDateTime dt1 = QDateTime::currentDateTimeUtc();
          const QDateTime dt2 = QVariant( dt1.toUTC() ).toDateTime();
          const QString dts = QVariant( dt1 ).toString();
          const QDateTime dt3 = QVariant( dts ).toDateTime();
      
          qWarning()
              << ( dt1 == dt2 ) // true
              << ( dt1 == dt2 ) // true
              << ( dt1 == dt3 ) // false
              << dts
          ;
      
          //return a.exec();
          return 0;
      }
      

      Attachments

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

        Activity

          People

            mitch_curtis Mitch Curtis
            pasnox Filipe Azevedo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes