[fpc-pascal] Timezone information in a dataset datetime field?- updated

Jürgen Hestermann juergen.hestermann at gmx.de
Mon Jul 25 18:23:21 CEST 2011



Reinier Olislagers schrieb:
 > I realize having a local timezone option will result in a hornet's nest
 > of adjustments for Daylight Saving Time etc... I'll try and check to see
 > if it is possible to specify the timezone description instead of the
 > offset in the export datetime field.
 > If so, I'll try and get timezone description from the OS...

Timezone information is not enough to get reliable dates. Dependend on 
where dates origin from they can be wrong (wrong clock on computer, 
wrong time zone on computer, file times extracted from archives not 
storing time zone). Also, when calculating UTC time on a local 
(computer) there is an ambiguity for times 2:00h to 3:00h when daylight 
saving is invoked in spring. A time of 2:30h can be before or after 
having switched back the clock but a program cannot determine which case 
applies from the computer clock alone.

And even if dates are correctly stored in UTC it is not easy to reliably 
get back the "local time". Daylight savings were changed in the past 
(and may also change in the future). If you have a date/time of  
2001-05-01 18:00 UTC it is not easy to predict what local time it was in 
time zone x. You would need a history of all daylight saving algorithms 
of the past and the future for all time zones (or even countries).

Having time zones added (or storing it in UTC) is better than not doing 
this but it's still far away from being "correct".



More information about the fpc-pascal mailing list