Error converting a string date/time to DateTime apparently related to Daylight Saving Time #59409
Open
2 tasks done
Labels
Bug
Either a bug report, or a bug fix. Let's hope for the latter!
Expressions
Related to the QGIS expression engine or specific expression functions
Localization
Issues with language support in numbers representation
What is the bug or the crash?
I was trying to convert a string field containing date and time information, to a Date&Time field with the expression:
to_datetime('1994-03-27 00:00:00','yyyy-MM-dd hh:mm:ss')
It worked well until it find a specific date/time:
to_datetime('1994-03-27 01:00:00','yyyy-MM-dd hh:mm:ss')
Eval Error: Cannot convert '1994-03-27 01:00:00' to DateTime
After some tests I've found that, for instance, this conversions work as expected:
But those does not work and give the Eval Error:
The relation between '1994-03-27 01:00:00', '2022-03-27 01:00:00' and '2024-03-31 01:00:00' is that corresponds to the hour when the change between Winter Time to Summer Time occurs, and the 01:00:00 becomes 02:00:00:
https://en.wikipedia.org/wiki/Summer_time_in_Europe
I'm in Portugal, with Western European Time / Greenwich Mean Time.
I've tested on Windows, with QGIS 3.28, 3.34, 3.36 and 3.38, and all of them have this issue.
I've tried to change the Locale from
to
without success.
In Linux the error does not occurs and everything works fine.
Steps to reproduce the issue
To test, simply open the Field Calculator and paste the expression:
to_datetime('1994-03-27 01:00:00','yyyy-MM-dd hh:mm:ss')
Versions
<style type="text/css"> p, li { white-space: pre-wrap; } </style>Supported QGIS version
New profile
Additional context
No response
The text was updated successfully, but these errors were encountered: