Hi all, Ive been playing with node red for a while to set up to home automation. Its all going well and is up and running but I noticed this morning things happening at an unexpected time and I found this is due to the time in node red not being the same time zone as the raspberry pi that its running on.
I found the following discussion and followed the guide in the last post, I have added
process.env.TZ = "Europe/London";
to the settings.js file and this didnt resolve it.
I have copied the function to a simple page to post here. Hopefully this is formatted correctly.
Thanks
[{"id":"52175ebb.b4914","type":"tab","label":"Time Test","disabled":false,"info":""},{"id":"6bbeb4e0.742adc","type":"function","z":"52175ebb.b4914","name":"time","func":"var now = msg.now;\n\nvar dateTime = new Date(now).toLocaleString();\nvar dateTimeStamp = new Date(now);\n\nmsg.r = {\n time_locale : dateTime,\n time_timestamp : dateTimeStamp\n}\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":300,"wires":[["bd43b9f6.9e6fa8"]]},{"id":"58325b00.b3d8a4","type":"inject","z":"52175ebb.b4914","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":300,"wires":[["5bd53355.d3c3fc"]]},{"id":"bd43b9f6.9e6fa8","type":"debug","z":"52175ebb.b4914","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":730,"y":300,"wires":[]},{"id":"5bd53355.d3c3fc","type":"change","z":"52175ebb.b4914","name":"timestamp","rules":[{"t":"set","p":"now","pt":"msg","to":"","tot":"date"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":300,"wires":[["6bbeb4e0.742adc"]]}]