[Gambas-user] With Date one day less

Gianluigi bagonergi at ...626...
Sat Jan 21 20:15:25 CET 2017


Hi Benoit,
You are always very kind, your explanation has allowed me to understand.

The string data is assumed at 00:00:00 and therefore one hour back from the
day before.
If I had written
'---------------------------------
Public Sub Main()

  Dim d1 As Date

  d1 = "6/15/2008 01:00:00"
  Print Format$(d1, "dd mm yyyy") ' > 15 06 2008

End
'----------------------------------
I got the right date being an hour ahead of us.

Thank you very much
Regards

Gianluigi

2017-01-21 19:34 GMT+01:00 Benoît Minisini <gambas at ...1...>:

> Le 21/01/2017 à 19:22, Gianluigi a écrit :
> > Hi Charlie,
> >
> > I thank for the answer and will do so too.
> > But my poor mind cannot comprehend the question of time zone.
> >
> > Regards
> > Gianluigi
> >
> >
>
> If you convert a string to a date, then the string is assumed to be an
> UTC time, *not* a local time.
>
> To convert a local time as a string to a date, you must use the Val()
> function. Or, as Karl said, you can use the Date() function if you have
> the date split into its different components.
>
> It's exactly the same with numbers!
>
> CStr() and CFloat() assume the american format (which is like "UTC" for
> numbers).
>
> Str() and Val() assume the local format.
>
> Regards,
>
> --
> Benoît Minisini
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list