Setting the timezone in Node-RED

Today I was strugling with the node red ‘time range switch’. I noticed it was switching at a different time I intended. After some research I came to the conclusion the timezone setting for Node RED was wrong even with the server timezone set correctly.

After figuring out the root cause setting the timezone in NodeRED solved the issue. To change the timezone in NodeRED add the following line to ‘settings.js’ (located in ‘$home/.node-red’):

process.env.TZ = "Europe/Brussels";


  1. Peter on January 9, 2019 at 9:32 am

    a msg.payload = new Date().toLocaleString(); in a function should report it as per the server time

    Sun Sep 21 2014 20:31:23 GMT+0100 (BST)

  2. Viktor on November 4, 2019 at 6:57 pm

    Thanks @Peter! This solved the issue for me.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.