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

QDateTime::fromString parses milliseconds incorrectly when text has trailing spaces

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.14.1, 5.15.0 Alpha
    • 5.9.7, 5.12.2
    • Core: Date/Time
    • None
    • Linux/X11, Windows
    • 653c1aab185fe59a523f16ffe0cf7b9173c2ff68 (qt/qtbase/5.14)

    Description

      When spaces appear after the parsed date, the QDateTime::fromString() function parses milliseconds incorrectly:

      QDateTime d = QDateTime::fromString("2000-01-02 03:04:05.678 ", Qt::ISODate);
      QString s = d.toString("yyyy-MM-dd hh:mm:ss.zzz"); // Gives "2000-01-02 03:04:05.068"

      Attachments

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

        Activity

          People

            Eddy Edward Welbourne
            amiart Robert Szefner
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes