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

QDate::fromString("9999-03-06","yyyy-MM-dd") is invalid

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.11.0
    • 4.7.4, 5.9.0
    • Core: Date/Time
    • None
    • a755c2e52126bea850a04487a9a7d446b03e892a

    Description

      Hi all,

      currently I'm converting some Dates from an Access "DB" to a MySQL DB using Qt and during this progress I've discovered a "bug".

      I have the following date "9999-03-06" which formed the problem, because in Qt5.9.X with the following line it will be invalid:

       

      QDate date = QDate::fromString("9999-03-06","yyyy-MM-dd"); //invalid
      int year = date.year(); //0
      

      In Qt4.7.4 I get:

      QDate date = QDate::fromString("9999-03-06","yyyy-MM-dd"); //invalid
      int year = date.year(); //-4713
      

      .. but it works by using Qt::ISODate:

      QDate date = QDate::fromString("9999-03-06",Qt::ISODate); //valid
      int year = date.year(); //9999
      

      So "yyyy-MM-dd" isn't Qt::ISODate?!

      I'm a bit confused about the that.

      .. and if you're asking for "YYYY-MM-DD". It doesn't makes a difference.

      Kind regards,
      Mike

       

      Attachments

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

        Activity

          People

            Eddy Edward Welbourne
            lachrymology Mike
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes