[Gambas-user] CDate Documentation
Benoit Minisini
benoit.minisini at gambas-basic.org
Tue Nov 15 09:21:31 CET 2022
Le 15/11/2022 à 03:06, Jussi Lahtinen a écrit :
> If you want the timezone in use, just use 'Val()' then. Leave
> 'CDate()'
> alone. I don't see why it is a problem.
>
>
> Yes, I don't use CDate at all, but still the problem occurs when
> switching from summer time to winter time.
>
>
> Let's say I have a date variable, which contains my chosen date
> "something 12:00", which internally (IE in UTC) is "something 10:00" (in
> reality of course as float).
No, Gambas "Dates" are not "internally UTC" at all.
Again, Gambas "Dates" are not dates, they are timestamp, i.e. *points in
time*.
> Now suddenly "timezone changes" and instead of +2, becomes +1. IE still
> internally "something 10:00", but shown is "something 11:00".
> IE the shown is *not* the date I have chosen!
Because you think you are storing a date inside the Date datatype,
whereas you are not.
Here is a similar confusion with strings and charsets.
``
Let's say I have a String variable, which contains my chosen character
string "Winter is coming", which internally is 87, 105, 110, 116, 101,
114, 32, 105...
Now suddenly my local charset changes, and instead of "Windows-1252"
becomes "EBCDIC-FR". IE still internally 87, 105, 110..., but shown is
"払���@��@������". IE the shown is *not* the character string I have chosen!
''
Of course, as you don't store characters in a string, but bytes. Bytes
becomes characters through a charset. There is always an implicit
charset when Gambas deals with String datatype. UTF-8 or ASCII. And so
there is always an implicit timezone when dealing with Date datatype.
Regards,
--
Benoît Minisini.
More information about the User
mailing list