# Trouble with timezone in Node-Red, Docker, Synology NAS

**URL:** <https://discourse.nodered.org/t/trouble-with-timezone-in-node-red-docker-synology-nas/81998>\
**Category:** General\
**Tags:** docker\
**Created:** [13 October 2023 11:27 UTC](https://discourse.nodered.org/t/trouble-with-timezone-in-node-red-docker-synology-nas/81998 "2023-10-13T11:27:59Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel-WW](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/daniel-ww/32/70938_2.png) [@Daniel-WW](https://discourse.nodered.org/u/Daniel-WW)\
**Post date:** [13 October 2023 11:27 UTC](https://discourse.nodered.org/t/trouble-with-timezone-in-node-red-docker-synology-nas/81998/1 "2023-10-13T11:27:59Z")

</div>

Hello,

I'm running node-red in a docker container on a Synology NAS.  
Unfortunately, I'm not able to set the right, local Timezone (Europe/Berlin).

I mounted the following Volumes

```auto
      - /etc/TZ:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro

```

and I did also insert the Timezone in the settings.js

```auto
process.env.TZ = "Europe/Berlin";

```

but in Node-red I still only get the UTC-Time (Timestamp).

I would be glad, to find some help ore advices here.

Thanks in advance and best regards - Daniel

---

<div class="post-metadata">

**Author:** ![Daniel-WW](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/daniel-ww/32/70938_2.png) [@Daniel-WW](https://discourse.nodered.org/u/Daniel-WW)\
**Post date:** [2 November 2023 17:17 UTC](https://discourse.nodered.org/t/trouble-with-timezone-in-node-red-docker-synology-nas/81998/2 "2023-11-02T17:17:00Z")

</div>

Doesn‘t anyone know the problem or can anyone give me some advice?

Thanks in advance - Daniel

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [2 November 2023 18:00 UTC](https://discourse.nodered.org/t/trouble-with-timezone-in-node-red-docker-synology-nas/81998/3 "2023-11-02T18:00:33Z")

</div>

What are you doing that tells you it is UTC?  
What does Date.getTimezoneOffset() give?

---

<div class="post-metadata">

**Author:** ![Daniel-WW](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/daniel-ww/32/70938_2.png) [@Daniel-WW](https://discourse.nodered.org/u/Daniel-WW)\
**Post date:** [3 November 2023 09:58 UTC](https://discourse.nodered.org/t/trouble-with-timezone-in-node-red-docker-synology-nas/81998/4 "2023-11-03T09:58:53Z")

</div>

Hi, the TimezoneOffset ist -60, which seems to be correct for Germany.  
But if I want to use a timestamp like

> var currentDate = new Date();

I always get the UTC-Time. And if I then want to continue using it, I always have a difference of one hour to the current local time.

I'm still a newbie to working with nodered and programming stuff like this, but I thought if I asked for the actual time, I would get the current local time. - Thanks for help!

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [3 November 2023 10:13 UTC](https://discourse.nodered.org/t/trouble-with-timezone-in-node-red-docker-synology-nas/81998/5 "2023-11-03T10:13:43Z")

</div>

> [@Daniel-WW](#):
>
> I always get the UTC-Time.

What do you mean by that?

> [@Daniel-WW](#):
>
> if I then want to continue using it,

What is it that you want to do with it?

Remember there is only one time, 12:00 UTC is the same time as 13:00 UTC+1, they are just different ways of displaying the same time.

---

<div class="post-metadata">

**Author:** ![Daniel-WW](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/daniel-ww/32/70938_2.png) [@Daniel-WW](https://discourse.nodered.org/u/Daniel-WW)\
**Post date:** [3 November 2023 11:44 UTC](https://discourse.nodered.org/t/trouble-with-timezone-in-node-red-docker-synology-nas/81998/6 "2023-11-03T11:44:27Z")

</div>

Hi, thanks for the quick response. For various events I have set up context variables that contain an entry in conjunction with a timestamp: E.g. last change in temperature, in conjunction with a timestamp.

> {"temp":20.16,"timestamp":"2023-11-03T11:13:56.872Z"}

If I print the variable with debug as mentioned before, I can see that the temperature changed at 13:56 (UTC+0). But in local time (Germany) the temperature changed at 12:56 (UTC+1).

My assumption was that I would get the local time with "new Date()" and that consequently nodered's time setting should have been incorrect. But now I assume that it is correct that the timestamp always includes UTC+0?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [3 November 2023 12:09 UTC](https://discourse.nodered.org/t/trouble-with-timezone-in-node-red-docker-synology-nas/81998/7 "2023-11-03T12:09:21Z")

</div>

> [@Daniel-WW](#):
>
> {"temp":20.16,"timestamp":"2023-11-03T11:13:56.872Z"}

Assuming that the timestamp was created using `new Date()` then the date shown is just the way the debug panel has chosen to display it.

> [@Daniel-WW](#):
>
> If I print the variable with debug as mentioned before, I can see that the temperature changed at 13:56 (UTC+0). But in local time (Germany) the temperature changed at 12:56 (UTC+1).

I think you meant 12:56 UTC - 1.

As I said earlier, 13:56 UTC and ~~14:56~~ 12:56 UTC-1 are the same time.

> [@Daniel-WW](#):
>
> My assumption was that I would get the local time with "new Date()"

You get _the_ time.

In what way is this causing you a problem?

---

<div class="post-metadata">

**Author:** ![Daniel-WW](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/daniel-ww/32/70938_2.png) [@Daniel-WW](https://discourse.nodered.org/u/Daniel-WW)\
**Post date:** [3 November 2023 17:27 UTC](https://discourse.nodered.org/t/trouble-with-timezone-in-node-red-docker-synology-nas/81998/8 "2023-11-03T17:27:31Z")

</div>

I think I'm fine with this result. I was able to find out that Node-Red is set with the correct timezone, and I understood how the timestamp thing works. Thanks for your help! Best regards - Daniel

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [17 November 2023 17:27 UTC](https://discourse.nodered.org/t/trouble-with-timezone-in-node-red-docker-synology-nas/81998/9 "2023-11-17T17:27:36Z")

</div>

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