I have the following situation:
QDate fixDate = QDate::fromString(QString("270912"), "ddMMyy");
the year returned is 1912
. I do not understand why and how get the correct year.
Thanks in advance
Qt always interprets a two-digit year as 19yy
.
So it's best to modify the input string to look like YYYY
.
Note: parsing it as YY and adding 100 years fails on Feb 29, 2000. '22900' is seen as February 29, 1900, but - surprise! - in the Gregorian calendar 1900 is not a leap year. So you get an invalid QDate, which remains invalid after adding 100 years to it.