[Gambas-user] Format function changes date value

Benoît Minisini g4mba5 at gmail.com
Thu Jun 7 17:12:46 CEST 2018


Le 07/06/2018 à 16:51, Gianluigi a écrit :
> I wrote it even if I imagined it was wrong (it works here), I'm sorry.
> It's useless, with the dates I still do not understand anything.
> These coming days, I will try to write a my wiki to and submit it to 
> your judgment.
> 
> Regards
> Gianluigi
> 

I try to explain again:

1) Date & times are internally represented in UTC date. See them as a 
number of days since an absolute instant in the past. You can get this 
number with CFloat(AnyDate). The integer part is the number of days, the 
fractional part is the part of the day (the precision is the millisecond).

2) Each time you read or you write a date & time as a string, you *must* 
know the timezone associated with the string representation. *But* this 
timezone is implicit, as it is not written inside the string 
representation (something that I should add to Gambas).

In other words, "2018/6/7" *cannot* represent an absolute time instant. 
It depends on the implicit timezone.

3) So, all Gambas functions that deal with date & time as a string 
*must* assume a timezone. Some functions assume UTC timezone, and others 
assume local timezone. Normally, all documentation pages on the wiki 
says which one is used.

Is it clearer now?

-- 
Benoît Minisini


More information about the User mailing list