[Gambas-user] CDate Documentation

Jussi Lahtinen jussi.lahtinen at gmail.com
Sun Nov 13 21:02:47 CET 2022


> You both don't get it.
>
> When transforming a string into a date, there is no such "no conversion"
> thing. You must guess an implicit timezone. Exactly with a string, where
> you have to guess an implicit charset.
>

No, Benoit you don't get it. The assumed time zone does not matter,
when the conversion is left to the user. It can be anything I want.


So you have CDate(), that uses UTC as timezone, and Val(), that uses the
> timezone of the current localization.
>
> CDate() is the contrary of CStr(). I.e.: CStr(CDate(X)) = X and
> CDate(CStr(aDate)) = aDate. The same way, Val() is the contrary of Str()
> or Print (which uses Str() to print its arguments).
>
> Jussi wants 'CDate()' to act like 'Val()'. But then just use 'Val()',
> not 'CDate()'.
>

No. All that is just an unnecessary mess.


A real enhancement would be to add a syntax to allow to specify the
> timezone explicitely inside the string representation of a date:
>
> CDate("11/11/2020 13:00:00 UTC+2") for example.
>

I agree, this would also fix the problem.


Jussi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20221113/9a6bce51/attachment.htm>


More information about the User mailing list