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

Re: sString = Date(hBlah) returns 11pm


Le 12/04/2024 à 22:52, Bruce Steers a écrit :

Not long ago using the following...

Dim sString as String
sString = Date(Now)
Print sString

Would print the date without the time


No.

Date(Now) moves its date argument to midnight in the current local time.

Affecting that date to a string variable converts it using CStr(), which will print the date in UTC time (and so with a time unless your local time is the UTC time).

It's `Print Date(Now)` or `sString = Str(Date(Now))` that will print a date at midnight (or without time).

Regards,

--
Benoît Minisini.


Follow-Ups:
Re: sString = Date(hBlah) returns 11pmBruce Steers <bsteers4@xxxxxxxxx>
References:
sString = Date(hBlah) returns 11pmBruce Steers <bsteers4@xxxxxxxxx>