# Access to Timestamp different values

**URL:** <https://discourse.nodered.org/t/access-to-timestamp-different-values/43600>\
**Category:** General\
**Created:** [3 April 2021 13:49 UTC](https://discourse.nodered.org/t/access-to-timestamp-different-values/43600 "2021-04-03T13:49:06Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![IvanG](https://avatars.discourse-cdn.com/v4/letter/i/2acd7d/32.png) [@IvanG](https://discourse.nodered.org/u/IvanG)\
**Post date:** [3 April 2021 13:49 UTC](https://discourse.nodered.org/t/access-to-timestamp-different-values/43600/1 "2021-04-03T13:49:06Z")

</div>

Hey guys,

I'm using "Inject" node with payload: timestamp, connected to a "debug" node(attachment).  
I've just found there are four different values of the timestamp when you click on the payload in the debug section.

Is there any way to access these four values by using a function or something else?

Thank you 😉

 ![Timestamp](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/1/21e72612f933223e83739c5d93b6bb4f6a1f089e.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [3 April 2021 14:39 UTC](https://discourse.nodered.org/t/access-to-timestamp-different-values/43600/2 "2021-04-03T14:39:48Z")

</div>

Those are all the same time.

What do you want to do that needs it in a different format? If you want it as a js Date use  
`let date = new Date(msg.payload)`

---

<div class="post-metadata">

**Author:** ![edje11](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edje11/32/572_2.png) [@edje11](https://discourse.nodered.org/u/edje11)\
**Post date:** [3 April 2021 14:41 UTC](https://discourse.nodered.org/t/access-to-timestamp-different-values/43600/3 "2021-04-03T14:41:23Z")

</div>

Hi,

The values are the same, only the way they are displayed changes when clicking on them.  
So accessing the values with a function node will give the same result

If you want a payload with different representation of date/time have a look at the [node-red-contrib-moment (node) - Node-RED](https://flows.nodered.org/node/node-red-contrib-moment) node.

---

<div class="post-metadata">

**Author:** ![IvanG](https://avatars.discourse-cdn.com/v4/letter/i/2acd7d/32.png) [@IvanG](https://discourse.nodered.org/u/IvanG)\
**Post date:** [3 April 2021 16:47 UTC](https://discourse.nodered.org/t/access-to-timestamp-different-values/43600/4 "2021-04-03T16:47:38Z")

</div>

Hi again,

that was fast response 😉 Thank you.

The values 2( 13:35 ) and 3( 3:35 PM) are different - 2 hours difference. Value 3 is the local time in Germany and I guess it's coming from the raspberry. Currently I'm using "moment node", but I had a problem after switching to summer time - manually change the adjustment of the hours. So to avoid that change every summer and winter I'm looking for another solution and this thing with the timestamp looks good if I can access it.

 ![Timestamp1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/0/40ead4a60c9ef04b0f01186069ade12172680adf.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [3 April 2021 17:14 UTC](https://discourse.nodered.org/t/access-to-timestamp-different-values/43600/5 "2021-04-03T17:14:00Z")

</div>

> [@IvanG](#):
>
> The values 2( 13:35 ) and 3( 3:35 PM) are different - 2 hours difference.

No they aren't, notice that one is UTC (that is what the Z means) and one is UTC+2. They are the same time.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [3 April 2021 17:25 UTC](https://discourse.nodered.org/t/access-to-timestamp-different-values/43600/6 "2021-04-03T17:25:15Z")

</div>

Tell us what you are trying to accomplish, there is probably a simple way to do it.

---

<div class="post-metadata">

**Author:** ![IvanG](https://avatars.discourse-cdn.com/v4/letter/i/2acd7d/32.png) [@IvanG](https://discourse.nodered.org/u/IvanG)\
**Post date:** [3 April 2021 18:11 UTC](https://discourse.nodered.org/t/access-to-timestamp-different-values/43600/7 "2021-04-03T18:11:01Z")

</div>

I'm using an inject node with timestamp and moment node to display current date and time and it was working good until the change of the time from CET(Central European Time) to CEST (Central European Summer Time). After that change I had to increase with 1 hour the moment node to display the correct time. So when switching back from CEST to CET I have to decrease with 1 hour and like that twice in a year 😃 Not a big deal, but... it could be automatically I guess.

 ![CET_CEST](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/1/e1eb3c535d26b7429f31b8d783237b7b1d06e405.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [3 April 2021 18:31 UTC](https://discourse.nodered.org/t/access-to-timestamp-different-values/43600/8 "2021-04-03T18:31:57Z")

</div>

You dont need to adjust the flow twice a year.

Try removing the input and/or output timezone specifiers, adjust your clock, restart node-red, check.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [3 April 2021 20:14 UTC](https://discourse.nodered.org/t/access-to-timestamp-different-values/43600/9 "2021-04-03T20:14:37Z")

</div>

As Steve says, if you make sure the node red machine is setup with your time zone then all you have to do is to get node-red to display the timestamp in local time and it will do it for you.

---

<div class="post-metadata">

**Author:** ![IvanG](https://avatars.discourse-cdn.com/v4/letter/i/2acd7d/32.png) [@IvanG](https://discourse.nodered.org/u/IvanG)\
**Post date:** [3 April 2021 20:53 UTC](https://discourse.nodered.org/t/access-to-timestamp-different-values/43600/10 "2021-04-03T20:53:12Z")

</div>

Thank you guys, problem solved. I deleted the input and output timezone specifiers and the node determined automatically a new one from the system. Now it works perfectly 😉

 ![ProblemSolved](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/6/263d7a418da0c07d03497eee1b7238dc911a5b80.png)

---

<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:** [17 April 2021 20:54 UTC](https://discourse.nodered.org/t/access-to-timestamp-different-values/43600/11 "2021-04-17T20:54:02Z")

</div>

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