[Gambas-user] CDate Documentation

Benoit Minisini benoit.minisini at gambas-basic.org
Tue Nov 15 09:30:43 CET 2022


Le 15/11/2022 à 03:38, BB a écrit :
> @ everyone
> 
> Just in case everyone is cooling down, what's this?
> 
> Public Sub Main()
> 
>    Dim LunchDate As Date
> 
>    LunchDate = Date(2023, 5, 1, 12, 30, 0)
>    Print Format(LunchDate, "ddd d mmm yy hh:nn t")
> 
> End
> 
> Outputs: *Mon 1 May 23 12:30 ACDT*
> 
> Here in South Aus it is currently late spring and daylight savings is in 
> use. The TZ abbrev is ACDT.
> 
> But the 1st of May next year is NOT daylight saving time. It should 
> print IMO *Mon 1 May 23 12:30 ACST*
> 
> 
> 😮
> 
> b
> 

Because you think Gambas Date datatype stores a date. But it does not.

A Gambas Date is a *point in time*.

``LunchDate = Date(2023, 5, 1, 12, 30, 0)'' means:

Store in LunchDate the "time point" associated with the specified local 
date in current timezone.

``Print Format(LunchDate, "ddd d mmm yy hh:nn t")'' means:

Get that time point and print the date associated with it in local 
format using the current timezone.

Anyway I don't think there is an API in Linux to know what the timezone 
is for a specific timestamp (and a specific country).

Regards,

-- 
Benoît Minisini.



More information about the User mailing list