On 2 March 2018 at 15:36, Corn98 <
jmaco...@gmail.com> wrote:
> If i run command prompt "date" in Siemens device (i established a ssh
> connection with PuTTY) it displays "Fri Mar 2 14:30:13 UTC 2018" at local
> hour 14:30.
OK, that is the fundamental problem, the Siemens device is not set up
to use your local timezone. A bit of googling suggests that device
does not in fact support timezones.
>
> The timestamp in the debug window is correct to my local hour because it is
> based on that set in Siemens device. But if I run getTimezoneOffset() in
> flow editor, offset is 0, instead in NR dashboard it returns -60, rightly.
No, the timestamp in the debug window (above each item) comes from the
browser (I think) not from node-red. It is correct because the laptop
is set to the correct timezone. When you run getTimezoneOffset that
is not running in the browser it is running on the Siemens device and
so it correctly says zero (since the timezone in the Siemens is UTC).
My suggestion is to write your flow taking into account the fact that
the Siemens timezone is UTC, and manually adjusting the time if you
need to get to local time. Use a global context variable for the
timezone offset and then you can adjust in one place if at some point
the Siemens device starts using TZ correctly. Remember though that
any code you run in a ui_template is run in the browser and therefore
will have access to the timezone.
The only thing I don't understand is why node.js does not take notice
when you set TZ in settings.js. I presume you are not using an
ancient version of node.
Colin
>
https://groups.google.com/d/msgid/node-red/fc43057b-fe9c-4547-a368-11db41902c61%40googlegroups.com.