I'm having an issue with the 'yy' matcher (but not the 'yyyy' matcher) on QDateTime. The code fragment is Python (using PyQt bindings for the Qt application framework), but I assume you can manage any needed translation since the strings and calls are basically the same. FYI the u prefix on u'text' simply forces Python strings to use unicode. Here's my test code:

Qt Code:
  1. from PyQt4.QtGui import *
  2. from PyQt4.QtCore import *
  3.  
  4. date_works_text = u'Monday, 23 April 2012 22:51:41'
  5. date_works_pattern = u'dddd, d MMMM yyyy hh:mm:ss'
  6.  
  7. date_broken_text = u'Monday, 23 April 12 22:51:41'
  8. date_broken_pattern = u'dddd, d MMMM yy hh:mm:ss'
  9.  
  10. date_works = QDateTime.fromString(date_works_text, date_works_pattern)
  11. date_broken = QDateTime.fromString(date_broken_text, date_broken_pattern)
  12.  
  13. print date_works.toString()
  14. print date_broken.toString()
To copy to clipboard, switch view to plain text mode 

The output on my system is:

Qt Code:
  1. D:\Users\...>qDateTimeTest.py
  2. Mon Apr 23 22:51:41 2012
  3. <blank line where the second toString() should be>
To copy to clipboard, switch view to plain text mode 

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/qda...tml#fromString)

Am I doing something wrong? If not, can someone confirm that this is a Qt issue (versus PyQt) issue? If you can't reproduce it in Qt, I'll check with the PyQt folks. This just seemed like the right place to start since the alternate 'yyyy' works fine.