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

QDate and QDateTimeEdit parses 2-digit years differently

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P3: Somewhat important
    • Some future release
    • 4.3.4
    • Core: Date/Time
    • None

    Description

      QDate parses 2-digit years to belong in the 1900s. This is the case with both the QDate(int y, int m, int d) constructor and the static fromString(const QString &string, const QString &format) function. So "08" will result in a QDate with the year 1908.

      QDateTimeEdit, on the other hand, parses 2-digit years to belong to whichever century the QDateTimeEdit was initialized with. By default, the QDateTimeEdit is initialized with the year 2000, so "08" will result in a QDate with the year 2008. If the QDateTimeEdit is initialized with the year 3267, "08" will result in a QDate with the year 3208.

      This is inconsistent.

      Attachments

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

        Activity

          People

            phartman Peter Hartmann (closed Nokia identity) (Inactive)
            sthomass Stian Sandvik Thomassen (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes