[Lazarus] Conversion from TField.AsDateTime to string

Hans-Peter Diettrich DrDiettrich1 at aol.com
Sat Sep 10 05:51:19 CEST 2011


Leonardo M. Ramé schrieb:

> To convert the JSON string to TDateTime, I use StrToFloat, then I
> show the result using:
> 
> FormatDateTime('YYYY-MM-DD', myDate);
> 
> On Linux I get: 2011-08-17 09:25:24
 > On Win32 I get: 34248-02-16 00:00:00
> 
> Why the difference?.

I'd guess that the time base is different for both OS, so that the float 
value is specific to the OS where the date was encoded. You can test 
yourself with a date set to 0.0.

If I'm right, dates should be stored as date strings, not as floats.

DoDi





More information about the Lazarus mailing list