Debug node - $moment() utc vs. local time

I am trying to create a debug message with time. I found the $moment() function and it does give me the local time. But when I add text to the message e.g. "text" & $moment() the function suddenly prints UTC time instead.

So how can I create a message with the local time?

image

If you just want the utc timestamp, I would just use $now(). If you want to use moment, then format the string
e.g.

[{"id":"321e49fa.dfa2d6","type":"inject","z":"b779de97.b1b46","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"\"text\" & $moment().format(\"YYY-MM-DD HH:mm:ss.SSS\")","payloadType":"jsonata","x":480,"y":1440,"wires":[["aed0b560.56a7a8"]]},{"id":"aed0b560.56a7a8","type":"debug","z":"b779de97.b1b46","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":710,"y":1440,"wires":[]},{"id":"81d7f489.3d8cf8","type":"inject","z":"b779de97.b1b46","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"\"text\" & $now()","payloadType":"jsonata","x":490,"y":1480,"wires":[["aed0b560.56a7a8"]]}]

"text" & $now()
"text" & $moment().format("YYY-MM-DD HH:mm:ss.SSS")
Moments is becoming depreciated.

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