Skip to content

DateTime: Convert Date changes time part when close to DTS boundary #2130

@pekkaklarck

Description

@pekkaklarck

DateTime had severe daylight saving time (DST) issues that were fixed in RF 2.9 (#2018). In the comments of that issue @huuhtaneno reported a problem that close to the DST transition Convert Date returns wrong time. For example,

Convert Date    2015-03-29 03:00

returns 2015-03-29 02:00. I reproduced the problem on my Windows machine and interestingly on Linux I got 2015-03-29 04:00 instead. The latter is kind of correct because on my timezone (Finland) there is a DST change so that clock is turned from 2015-03-29 03:00 to 2015-03-29 04:00. Changing the time like this is not good anyway.

These problems are due to DateTime converting dates internally to seconds since epoch and the conversion back not behaving exactly the same way. Most importantly, time.mktime that we use seems to be somewhat platform dependent.

Instead of trying to fix conversion to epoch seconds and back, it is much better to store dates internally as Python datetime objects. This also has a big benefit that it avoids problems with time.mktime not supporting dates before 1970 on Windows and before 1900 elsewhere (#1996).

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions