Hi all, is there any easy way / system variable to get the timestamp in epoch format?
Thanks!
SR.-
Hi all, is there any easy way / system variable to get the timestamp in epoch format?
Thanks!
SR.-
In my environment $now returns 1855491371, which is Wed Oct 18 2028 14:16:11 GMT+0000.
for example $sunrise returns 1/18/2022, 6:01:00 AM. which is correct
That’s strange, mine is coming back with correct date/time. Is the hub location set correctly?
(expression) $now »»» (datetime) 1642534196838
Tuesday, January 18, 2022 12:29:56.838 PM GMT-07:00
As I see, the problem is when I set the value of $now to a type long variable.
If I just print it, it’s fine.
It gets really interesting when you see almost a dozen different ways the same time can be displayed here in webCoRE.
You could try $localNow or add your timezone offset which you can get from:
round((($localNow-$utc)/3600000.0),0)
This equation creates the difference in hours. I think if you just divide by 1000, you will get the offset you want for your long variable.