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

QDate::from string gives wrong year

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P2: Important
    • None
    • 5.12.1
    • Core: Date/Time
    • None
    • Windows

    Description

      When system locale short date is set to show the year with two digits only the QDate::fromString() conversion results in a wrong century (1900 instead of 2000).

      // System local short date: dd-MMM-yy
      QDate d1= QDate::currentDate();
      QString s1 = d1.toString(Qt::SystemLocaleShortDate); // "11-Mrz-19"
      QDate d2= QDate::fromString(s1, Qt::SystemLocaleShortDate);
      QString s2 = d2.toString("dd.MM.yyyy"); // "11.03.1919"
      

      In 2019 the base century should be 2000 for two digit year dates.

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-74323
          # Subject Branch Project Status CR V

          Activity

            People

              Eddy Edward Welbourne
              elgerton Martin Elger
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There is 1 open Gerrit change