[Gambas-user] problem with the CDate function

Gianluigi bagonergi at gmail.com
Wed May 2 16:08:49 CEST 2018


2018-05-02 15:46 GMT+02:00 Benoît Minisini <g4mba5 at gmail.com>:

> Le 02/05/2018 à 15:38, Gianluigi a écrit :
>
>>
>>
>> 2018-05-02 15:18 GMT+02:00 Mayost Sharon <sharon at 455.co.il <mailto:
>> sharon at 455.co.il>>:
>>
>>     Hello
>>
>>     Operating system: Fedora 27 64 BIT
>>     Gambas 3.10.0
>>
>>     I have a problem with the CDate function when I run the example that
>>     appears in this
>>     documentation:
>>
>>     It takes me back one day
>>
>>     I run:
>>
>>
>>     Print CDate ("09/06/1972 01:45:12")
>>
>>     And it returns to me:
>>
>>     09/05/1972 22:45:12
>>
>>
>> You must use Date and not CDate which locates the UTC date [0].
>>
>> Regards
>> Gianluigi
>> [0] https://en.wikipedia.org/wiki/Coordinated_Universal_Time
>>
>>
> No, it's not the problem.
>
> It's just that people must understand that CDate() interprets its argument
> as an UTC date, and that Str() (hence Print) converts a date into a local
> representation.
>
> So if you use CDate(), you must use CStr() to go back to the original
> string. Otherwise, use Val() and Str().
>
> See the documentation about these functions. I think some non-american
> examples should be added to make things clearer.
>
> Regards,
>
> --
> Benoît Minisini
>
>
Every time I think I have finally understood the dates and its
conversions... :-(

Regards
Gianluigi


> --------------------------------------------------
>
> This is the Gambas Mailing List:
> https://lists.gambas-basic.org/listinfo/user
>
> Search the list:
> https://lists.gambas-basic.org/cgi-bin/search.cgi
>
> Hosted by https://www.hostsharing.net
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20180502/874b7f4a/attachment.html>


More information about the User mailing list