[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Date function


Le 05/11/2025 à 15:30, Gianluigi a écrit :
In the last master(3.21.99 784a0d4) the Date function does not work well, see attached image.

Regards
Gianluigi

No, it always worked that way, and it works normally.

You are confused because by writing:

TextBox1.Text = Date(Now)

you trigger the automatic date to string conversion. I.e. the code actually executed is:

TextBox1.Text = CStr(Date(Now))

And so you get the UTC time representation, not the local time representation.

And as you don't live in the UTC timezone, what is midnight on local time (the Date() function sets the time part to midnight in local time) becomes something else in UTC.

Beware to that PRINT converts values by using Str(), not CStr().

I suggest you carefully and slowly read:

https://gambaswiki.org/wiki/doc/date

and eventually:

https://gambaswiki.org/wiki/doc/calendar

so that you can deal with dates and times in Gambas with confidence!

P.S. Everybody should read these two pages slowly and carefully. :-)

Regards,

--
Benoît Minisini.


Follow-Ups:
Re: Date functionGianluigi <gradobag@xxxxxxxxxxx>
References:
Date functionGianluigi <gradobag@xxxxxxxxxxx>