[Lazarus] UnixToDateTime and time zone

José Mejuto joshyfun at gmail.com
Tue Sep 21 16:54:33 CEST 2010

Hello Lazarus-List,

Friday, September 17, 2010, 3:37:35 PM, you wrote:

D> UnixToDateTime and DateTimeToUnix don't uses any GMT/UTC calculation.
D> They just convert date time just as it is. I search internet for time
D> zone information in delphi and I found this article:
D> http://delphicikk.atw.hu/listaz.php?id=2667&oldal=52
D> I change his code to free pascal cross platform and this is working
D> function (tested on windows and linux):

Be carefull with that functions, they only apply to NOW! They are
completly useless and error prone as they only consider the "just now"
situation, so any other GMT/UTC time different than now could be
wrongly converted and apparently be ok.

Example, you record a time today 21 sept. 2010, in my local time
(CET-1CEST) there is an offset of +2 hours from GMT, you can go GMT to
local and back succesfully up to the last sunday of october where DST
is not applied anymore up to the next year. So any conversion done in
november over thet data recorded the 21 sept. 2010 will be converted
with an offset of +1 (november) instead the +2 offset (when the time was

To solve this you need PascalTZ or similar functions.

Best regards,

More information about the Lazarus mailing list