Localtime instead of UTC

Hello all!

I have problem with timezone in Node-Red. I read a lot about this issue but cannot find the solution yet. I use opcda-read node to read out data from OPC DA server. This node gives an object about the data including id, timestamp and value. I use node-red as an interface ie. I just collect data and write into the jason file for the other application running on same pc. The problem is that the timestamp in the object is UTC and it would be good to be the local time. As this is the output of the opcda-read node I don't think so it's too easy to convert the time with some function especially in case with large number of data. I tried to add process.env.TZ = 'Europe/Budapest' to the settings.js file but there is no change. I tried this on other pc's as well with JS expression $now() both on Windows and Linux OS machines but the situation is same. Is there any chance to force locatime instead of UTC in this object?



You should absolutely not try and put local time in the database (if that is what you are trying to do). Keep it in UTC and convert it to local when you display it, or need it in local for other requirements. What are you trying to do that requires it to be in local time?

Sorry, I misread the question, you are not using a database. Why does the other application need it in local time? All software should work in UTC and display the local equivalent when necessary.

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