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

QDateTime::fromString() - invalid short year format

XMLWordPrintable

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

      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());

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes