[Gambas-user] Best way converting dates into strings forth and back

Benoît Minisini g4mba5 at gmail.com
Fri Dec 10 15:55:47 CET 2021


Le 10/12/2021 à 14:59, Jussi Lahtinen a écrit :
>     You must use CStr() and CDate(), so that you store and retrieve
>     dates as
>     a string in UTC format.
> 
> 
> That doesn't really help.
> Let's say my clock says it's 13:00 and I store it in UTC, which makes it 
> 12:00.
> Now, if I restart my program after timezone madness event 
> <https://en.wikipedia.org/wiki/Daylight_saving_time> then suddenly the 
> 12:00 UTC is interpreted in my computer as something else than what I 
> originally stored, example 14:00.
> Thus that is useful only, if we could avoid the automatic conversions 
> from the UTC in every case. IE never show the time in a local way.
> Otherwise, the time I stored is not the time I tried to store.
> 
> Jussi
> 

You are confusing strings with dates.

Rolf-Werner wanted to store a date using a string. So we don't care if 
the timezone when reading is not the same as the timezone when writing.

It will still be the same date.

See https://gambaswiki.org/wiki/doc/date.

Regards,

-- 
Benoît Minisini


More information about the User mailing list