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

Re: Date function


Il 05/11/25 17:14, Benoît Minisini ha scritto:
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,


Dear Benoit,

Last time, several years ago, you warned about date changes, and never mind if they weren't retroactive.
But this time you did it secretly, and again without retroactivity.
Until you made the last change, the code I reported worked fine in the databases. Now, do we need to revise everything? Someone thinks they're recording today's date, but they're actually recording yesterday's date.
It seems dangerous, doesn't it?

Best regards
Gianluigi


Follow-Ups:
Re: Date functionBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
References:
Date functionGianluigi <gradobag@xxxxxxxxxxx>
Re: Date functionBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>