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

QDateTime::fromString() - invalid short year format

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 4.7.1
    • Core: Date/Time
    • None
    • Win7 SP1, VisualStudio 2008

    Description

      When using short year format while reading date from string, resulting QDateTime has year 19xx. This seems strange to me, because most operating systems convert two-digits year to interval 1930-2030.
      I suggest at least current DateTime should be 21st century.

      QDateTime dtNormal=QDateTime::currentDateTime();
      QString strDate=dtNormal.toString("ddMMyyhhmmss");
      QDateTime dtFromString=QDateTime::fromString(strDate,"ddMMyyhhmmss");
      qDebug(dtNormal.toString("ddMMyyyyhhmmss").toAscii());
      qDebug(dtFromString.toString("ddMMyyyyhhmmss").toAscii());

      Attachments

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

        Activity

          People

            earthdomain Earth Domain (Inactive)
            raiv Ivan Rogozhev
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes