Details
-
Bug
-
Resolution: Invalid
-
P2: Important
-
None
-
5.15.1
-
None
Description
Some old databases might contain invalid timestamp values due to summer time transition, i.e. "2015-03-29 02:09:11.001". The date component is valid, but the time not. QDateTime could handle this value in the past.
According to the documentation of function QDateTime::isValid()) handling of such timestamp should be still possible:
Time transition hour, i.e. if the transition is at 2am and the clock goes forward to 3am then the time from 02:00:00 to 02:59:59.999 is considered to be invalid.
This has been broken in the latest version which makes the auto correction impossible.
The following snippet explains the differences:
const QString strDT = "2015-03-29 02:09:11.001"; QDateTime dateAndTime = QDateTime::fromString(strDT,"yyyy-MM-dd hh:mm:ss.zzz"); dateAndTime.isNull() -> false in Qt 5.13.2, true in Qt 5.15.1 dateAndTime.isValid() -> false in both dateAndTime.date().isValid() -> true in Qt 5.13.2 and false in Qt 5.15.1
The following also does not work. Value returned is not null, but isValid() returns true (which is definitely wrong)
QDateTime dateAndTime = QDateTime(QDate::fromString("2019-03-12","yyyy-MM-dd"),QTime::fromString("02:09:11.001","hh:mm:ss.zzz"));
Attachments
Issue Links
- resulted from
-
QTBUG-83075 QDateTimeParser fails to set correct zone when parsing with a zone specified
-
- Closed
-