[Gambas-user] Possible CDATE issue Latest version
Brian G
brian at westwoodsvcs.com
Sat Nov 19 19:26:26 CET 2022
----- On Nov 19, 2022, at 9:43 AM, Benoit Minisini benoit.minisini at gambas-basic.org wrote:
> Le 19/11/2022 à 17:26, Brian G a écrit :
>>
>> ----- On Nov 19, 2022, at 2:43 AM, Benoit Minisini
>> benoit.minisini at gambas-basic.org wrote:
>>
>>> Le 18/11/2022 à 20:36, Brian G a écrit :
>>>> With the latest version of gambas, I am getting the strangest issue, I
>>>> dont understand, not sure if its a bug
>>>> cdate returns different values if called with a class public variable.
>>>> Locks like possibly like in the last case
>>>> its return the gmt time.
>>>>
>>>> Hello world 11/18/2022 11:30:56
>>>> CDATE(now) 11/18/2022 11:30:56
>>>> Eval("cdate(now)") 11/18/2022 11:30:56
>>>> dim thedate as string = "CDate(now)"
>>>> Try ddate = Eval(thedate) 11/18/2022 19:30:56.895
>>>>
>>>
>>> The printed strings are normal. What did you expect?
>>>
>>> --
>>> Benoît Minisini.
>>>
>>>
>>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>>
>> I expect the times to all be the same, the last time printed is a different time
>> zone
>> although the same expression is being evaluated.
>>
>
> It can't be the same as in your script, 'ddate' is a string that
> receives the result of evaluating an expression that returns a date.
>
> Hence this date is converted to a string automatically with CDate() to
> be put inside the 'ddate' variable, and so you get the UTC
> representation of the date as returned by CDate().
>
> Regards,
>
> --
> Benoît Minisini.
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
Maybe I am just a bit thick but I had expected
print cdate(now)
and
dim a as string = cdate(now)
print a
To produce the same output value!
This is what is produced
11/19/2022 10:19:18
11/19/2022 18:19:18.16
if this is correct output, why it seems so very wrong!
and doing this
print date(now)
or
a = date(now)
print a
produces as output
11/19/2022 00:00:00
11/19/2022 08:00:00
This also seems incorrect...
More information about the User
mailing list