[Gambas-user] Daylight "saving" and time zones

Benoît Minisini g4mba5 at gmail.com
Sun Oct 27 23:49:35 CET 2019


Le 27/10/2019 à 23:19, Jussi Lahtinen a écrit :
> if I do this:
> ? cstr(date.fromutc(date(2019,10,27,2,30)))
> 
> Is it guaranteed that in all possible localizations I will always get this?:
> 10/27/2019 02:30:00
> 

Yes.

- date(2019,10,27,2,30) returns the date 2019-10-27T02:30:00 [local time]

- Date.FromUTC() moves that date so that it becomes 2019-10-27T02:30:00 
[UTC] (it's "FromUTC" because the local representation of its date 
argument, i.e. what you pass to Date(), is assumed to be UTC).

- CStr() converts a date to its UTC representation.

I agree that Date() needs one more argument to define the timezone 
explicitely.

-- 
Benoît Minisini


More information about the User mailing list