Access to Timestamp different values

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 :wink:

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)

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 node.

Hi again,

that was fast response :wink: 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.

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.

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

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 :smiley: Not a big deal, but... it could be automatically I guess.

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.

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.

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 :wink:

1 Like

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