Logic Machine Forum
os.date with timezone offset - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: os.date with timezone offset (/showthread.php?tid=3316)



os.date with timezone offset - mishoboss - 24.04.2021

Is there a smart way to get the local time using os.date(), including the DST (Daylight Saving Time)? I would not like to add a hard-coded integer to the timestamp, but instead use something that calculates it for me, based on the timezone and taking account the DST.

Actually, is there a way to set the timezone in LogicMachine, so the local time of os.date() is correct?


RE: os.date with timezone offset - admin - 26.04.2021

You can set the timezone in Utilities > Date and time.


RE: os.date with timezone offset - kgroenhoej - 02.07.2021

(24.04.2021, 18:53)mishoboss Wrote: Is there a smart way to get the local time using os.date(), including the DST (Daylight Saving Time)? I would not like to add a hard-coded integer to the timestamp, but instead use something that calculates it for me, based on the timezone and taking account the DST.

Actually, is there a way to set the timezone in LogicMachine, so the local time of os.date() is correct?

Only os.date() reports the right time back for timezone. None of the %r or %X or %z or %Z works as they should according to strftime - no matter what is set in timezone in Utilities > Date and time.

You can get the right time for timezone by extracting the time from os.date()
ef:
TimeOfDayStr = string.match(os.date(), "%d%d:%d%d:%d%d")


RE: os.date with timezone offset - admin - 05.07.2021

os.date('%z') correctly reports the timezone offset accounting the DST.