[Gambas-user] Daylight "saving" and time zones

Jussi Lahtinen jussi.lahtinen at gmail.com
Mon Oct 28 03:35:12 CET 2019

> How do you write your date/time to the disk?
> If you use the READ/WRITE instructions, the date/time will be always
> read and written by Gambas in binary form, i.e. in UTC date/time.
> Otherwise, if you do that by yourself, you have to store the timezone
> with it manually.

This is how I load the alarms:

      sTotal = Settings[sPath &/ "Date&Time", ""]

      sStr = Split(sTotal, " ")

      sDate = Split(sStr[0], "/")
      sTime = Split(sStr[1], ":")

      hAlarm.hTotal = Date(sDate[2], sDate[0], sDate[1], sTime[0],
sTime[1], sTime[2])

This is how I save the alarms:

Settings[sPath &/ "Date&Time"] = Subst("&1/&2/&3 &4:&5:&6",
Format(Month(hAlarm.hTotal), "0#"), Format(Day(hAlarm.hTotal), "0#"),
Year(hAlarm.hTotal), Format(Hour(hAlarm.hTotal), "0#"),
Format(Minute(hAlarm.hTotal), "0#"), Format(Second(hAlarm.hTotal), "0#"))

IE, save and loaded as local time.

IE, if there is this on the disk:
Date&Time="10/28/2019 08:30:00"

It will be loaded 08:30 as local time and internally 06:30. But if time
zone changes, then it is suddenly 07:30 local time and internally 06:30.

Saving the values as UTC doesn't fix that as there is no control on how it
is interpreted/converted to local time.

Did you read the example I gave that applies within Finland?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20191028/1791cc6b/attachment.html>

More information about the User mailing list