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

'yy' short year tag not working

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 4.8.4
    • Core: Date/Time
    • None
    • Win 7, PyQt4, Qt 4.8.4
      Reproduced on 4.6.something in C++
    • 1b47059c886d76cc1a403e74abd034cce3b53a34

    Description

      I'm having an issue with the 'yy' matcher (but not the 'yyyy' matcher) on QDateTime. The code fragment below is Python (using PyQt bindings for the Qt application framework v4.8.4), but it has been reproduced by a C++ respondant on a forum:

      from PyQt4.QtGui import *
      from PyQt4.QtCore import *

      date_works_text = u'Monday, 23 April 2012 22:51:41'
      date_works_pattern = u'dddd, d MMMM yyyy hh:mm:ss'

      date_broken_text = u'Monday, 23 April 12 22:51:41'
      date_broken_pattern = u'dddd, d MMMM yy hh:mm:ss'

      date_works = QDateTime.fromString(date_works_text, date_works_pattern)
      date_broken = QDateTime.fromString(date_broken_text, date_broken_pattern)

      print date_works.toString()
      print date_broken.toString()

      The output on my system is:

      D:\Users\...>qDateTimeTest.py
      Mon Apr 23 22:51:41 2012
      <blank line where the second toString() should be>

      It appears to dislike a 'yy' match on '12' even though the pattern is included in the QDateTime format (http://qt-project.org/doc/qt-4.8/qdatetime.html#fromString)

      Attachments

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

        Activity

          People

            mitch_curtis Mitch Curtis
            claytondaley Clayton Daley
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes