Timestamp an hour out

Afternoon all I've used this in a function block to timestamp a JSON message:-

var timestamp = new Date()

This returns the dare and time but is an hour out. Based in the UK.

Is there a way it can be matched to the PC time & date as this is linked to a time & date sync server anyway.

Cheers
Ant

Lookup

toLocaleDateString()

To expand on Garry's response.

The returned timestamp is correct but your perception in an hour out :rofl:

More seriously, you asked for a timestamp and you got one in UTC/GMT/Zulu. You may wish to do yourself and your users a favour and keep everything in UTC except at the point of user access. This avoids all of the complex issues around DST and Timezones.

Thank you Julian, my bread timer went off as I was replying!
"Always UTC" indeed!

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.