node-red / node-red-dashboard

A dashboard UI for Node-RED
Other
1.3k stars 450 forks source link

Help with timeformat #826

Open PowerZone21 opened 6 months ago

PowerZone21 commented 6 months ago

Hello,

I have a flow that sets acrual date and time, but I can't figure out how to change timezone to UTC+1, I want to add one hour to the timeformat

Copy of the flow here:

[{"id":"b2132320a51ffb3a","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"786b066b780fa8b8","type":"inject","z":"b2132320a51ffb3a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":190,"y":180,"wires":[["b4f77de11a5c49da"]]},{"id":"72dbedd9548ccce0","type":"ui_text","z":"b2132320a51ffb3a","group":"3ba37fd4.6558f","order":0,"width":0,"height":0,"name":"","label":"Date: ","format":"{{msg.payload}}","layout":"row-spread","x":510,"y":220,"wires":[]},{"id":"b4f77de11a5c49da","type":"function","z":"b2132320a51ffb3a","name":"Format Time","func":"var d = new Date();\nvar options = { timeZone: 'UTC', year: 'numeric', month: '2-digit', day: '2-digit', hour:2-digit, minute:2-digit, second:2-digit};\nvar _resultDate = d.toLocaleDateString('no-NO', options);\nmsg.payload = _resultDate;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":370,"y":220,"wires":[["72dbedd9548ccce0"]]},{"id":"3ba37fd4.6558f","type":"ui_group","name":"Example Flow","tab":"72415252.b2cadc","order":1,"disp":true,"width":"8","collapse":false},{"id":"72415252.b2cadc","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

PowerZone21 commented 6 months ago

If possible, timezone for norway, witch have summer and wintertime

dceejay commented 6 months ago

We prefer general how-to type questions in the discussion forum where many more folk hang out and can help - and to keep the issues list for actual bugs and enhancements.

PowerZone21 commented 6 months ago

Thanks for feedback. I have edited my question