serverTime: 1618879709491

Hello
in my Node i have a information about time.
in the right side of the node output
i got a
serverTime: 1618879709491
when i do click two time i got something more usefull like
serverTime: 20.4.2021, 02:48:29 [UTC+2]

thats where i got the information
var serverTime = msg.payload[0].serverTime;
is ther option to set to get the second output as variable?

have a nice day
vinc

Hi @vikozo

You can convert the value to a JavaScript Date object and then use any of its to*String functions, such as toUTCString

msg.payload[0].serverTime = (new Date(msg.payload[0].serverTime)).toUTCString()

@knolleary
works perfect thanks a lot - just had to change it from

toUTCString() to toString() to get the central europe sommer time , but maybe would be a better way?

have a nice day
vinc

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