Problems with UTC time vs local time

81 views
Skip to first unread message

Peter Bos

unread,
Jan 5, 2022, 7:24:42 PM1/5/22
to Automate
I use a Alarm block to get the next alarm time and send that in a HTTP block to Domoticz. The time from the Alarm block is UTC time. This means that while my phone says the next alarm is at 11:45, Automate sends an integer corresponding to 10:45. I tried the localTime function with and without adding "Amsterdam" as time zone, but that didn't give me the correct value either.
I can correct this in Domoticz, but I don't want to because Domoticz will use values from other sources also and they don't need this correction. Adding one hour in Automate is not a solution since it is not correct in Daylight Saving Time. How do I convert the UTC time to local time before sending it with HTTP?

Peter

Henrik "The Developer" Lindqvist

unread,
Jan 6, 2022, 5:46:02 AM1/6/22
to Automate
A unix timestamp is always in UTC, i.e. it doesn't account for time zone, that has to be done when displaying, that's why the date functions takes a timezone argument.
Adding an hour is always timestamp + 3600 seconds, DST is irrelevant, it's basically just a different time zone.
Unix timestamps are used, and works the same, on most devices.

How is the timestamp sent to Domotic, as a formatted ISO date or an timestamp integer?
Reply all
Reply to author
Forward
0 new messages