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

Re: sString = Date(hBlah) returns 11pm


On Fri, 12 Apr 2024 at 23:18, Benoît Minisini <
benoit.minisini@xxxxxxxxxxxxxxxx> wrote:

> 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.
>

it is now always printing with time as 00:00:00 using sString =
Str(Date(Now))

But On 9th Feb (when i altered the wiki) assigning it to a string even
without Str() omitted the time completely.
Now, oddly, only the Split(Date(Now), " ")[0] method works to omit the time
text,

Respects
BruceS

Follow-Ups:
Re: sString = Date(hBlah) returns 11pmDimitris Anogiatis <dosida@xxxxxxxxx>
References:
sString = Date(hBlah) returns 11pmBruce Steers <bsteers4@xxxxxxxxx>
Re: sString = Date(hBlah) returns 11pmBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>