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

Reinier Olislagers reinierolislagers at gmail.com
Mon Jul 25 11:50:25 CEST 2011


On 25-7-2011 11:21, Reinier Olislagers wrote:
> On 25-7-2011 10:50, Ludo Brands wrote:
>>>> 1. Is there any way of knowing what kind of timezone a 
>>> datetime value 
>>>> should be in a FPC dataset? (I suppose not...)
>>>
>>> No, there is no way. It's always supposed to be 'local time'.
>>>
>>
>> That is also what most of the underlying databases do. They store everything
>> in UTC and convert to local time. Only for those that support "timezoned"
>> field types (fe. oracle timestamp_TZ) you can specify a timezone when
>> entering data. MySQL fe. doesn't have support for this.  
>>
>> Ludo  
>>
> 
> Mmmm. For example, IIRC, Firebird just stores it as entered - no UTC
> conversion.
> Sensible developers on multi country Firebird db projects would probably
> store convert date/time info to UTC in the database.
> 
> How about this choice:
>   TDateTimeStorageFormat = (UTC, Local {, StoredInDatabase});
>   //Treat date/time fields in datasets as stored in local time or UTC.
> Defaults to local time.
>   { TODO 7 -oAnyone -cNice to have : If we can support databases that
> store timezone info with date/time, e.g. Oracle, add an option
> StoredInDatabase }
> ....
>   TXMLXSDFormatSettings = class(TExportFormatSettings)
> ....
>     property DateTimeStorageFormat: TDateTimeStorageFormat
>       read FDateTimeStorageFormat write FDateTimeStorageFormat;

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...

Thanks,
Reinier



More information about the fpc-pascal mailing list