[Gambas-user] DateChooser.Value = one day less

Benoît Minisini g4mba5 at gmail.com
Thu Feb 18 13:06:08 CET 2021


Le 18/02/2021 à 12:22, Rolf-Werner Eilert a écrit :
> Am 18.02.21 um 12:11 schrieb Benoît Minisini:
>> Le 18/02/2021 à 12:07, Rolf-Werner Eilert a écrit :
>>>>
>>>> What do you mean by: "the result is '09/02/2021 23:00:00'"?
>>>>
>>>
>>> What I meant is "the string shown in the message.info"
>>>
>>> Public Sub DateChooser_Click()
>>>
>>>    Message.Info(DateChooser.Value)
>>
>> Message.Info() expects a string. By giving him a date, you trigger the 
>> automatic date to string conversion, which is *not* locale-aware. So 
>> what you see is the GMT date.
>>
>> See http://gambaswiki.org/wiki/doc/date
>>
>> Regards,
>>
> 
> Ah alright. When I use Day(DateChooser.Value) or DateChooser.Day, the 
> day is correct.
> 
> Ok... Anyway, it's quarter past 12, not midnight, and I live in GMT+1. 
> If it jumped back to 11:15...
> 
> This is not logical to me, but I need another cup of coffee anyway :)
> 
> Thank you for the hint
> Rolf
> 

It **is** actually logical. :-) The problem comes from the confusion 
between dates and their string representation, as explained in the wiki 
page.

-- 
Benoît Minisini


More information about the User mailing list