# Timestamp an hour out

**URL:** <https://discourse.nodered.org/t/timestamp-an-hour-out/61538>\
**Category:** General\
**Created:** [20 April 2022 11:29 UTC](https://discourse.nodered.org/t/timestamp-an-hour-out/61538 "2022-04-20T11:29:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![antsals](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@antsals](https://discourse.nodered.org/u/antsals)\
**Post date:** [20 April 2022 11:29 UTC](https://discourse.nodered.org/t/timestamp-an-hour-out/61538/1 "2022-04-20T11:29:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [20 April 2022 12:09 UTC](https://discourse.nodered.org/t/timestamp-an-hour-out/61538/2 "2022-04-20T12:09:43Z")

</div>

Lookup

```auto
toLocaleDateString()

```

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [20 April 2022 12:22 UTC](https://discourse.nodered.org/t/timestamp-an-hour-out/61538/3 "2022-04-20T12:22:11Z")

</div>

To expand on Garry's response.

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

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.

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [20 April 2022 14:38 UTC](https://discourse.nodered.org/t/timestamp-an-hour-out/61538/4 "2022-04-20T14:38:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [19 June 2022 14:38 UTC](https://discourse.nodered.org/t/timestamp-an-hour-out/61538/5 "2022-06-19T14:38:51Z")

</div>

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