# Strange inject behaviour giving wrong time

**URL:** <https://discourse.nodered.org/t/strange-inject-behaviour-giving-wrong-time/88055>\
**Category:** General\
**Tags:** docker\
**Created:** [17 May 2024 10:40 UTC](https://discourse.nodered.org/t/strange-inject-behaviour-giving-wrong-time/88055 "2024-05-17T10:40:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![muggins](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/muggins/32/63013_2.png) [@muggins](https://discourse.nodered.org/u/muggins)\
**Post date:** [17 May 2024 10:40 UTC](https://discourse.nodered.org/t/strange-inject-behaviour-giving-wrong-time/88055/1 "2024-05-17T10:40:58Z")

</div>

In terminal on my PI4 "date" shows correct time.  
In nodered if I inject to a debug and parse the epoch it is also the correct time (UTC+1)  
If I set a specific time in the inject node it outputs an hour late.  
I have recently converted to Docker but am reasonably confident that all the environment stuff is OK.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [17 May 2024 10:48 UTC](https://discourse.nodered.org/t/strange-inject-behaviour-giving-wrong-time/88055/2 "2024-05-17T10:48:57Z")

</div>

> [@muggins](#):
>
> In terminal on my PI4 "date" shows correct time.

> [@muggins](#):
>
> I have recently converted to Docker but am reasonably confident that all the environment stuff is OK.

It is the time zone inside the container that matters (because that is like a VM with its own timezone independent of the host)

Search the forum or WWW, this has been asked and answered a few times e.g:  
[https://discourse.nodered.org/search?q=%23docker%20timezone](https://discourse.nodered.org/search?q=%23docker%20timezone)

---

<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:** [17 May 2024 10:53 UTC](https://discourse.nodered.org/t/strange-inject-behaviour-giving-wrong-time/88055/3 "2024-05-17T10:53:24Z")

</div>

To check the time zone inside the docker container, use an exec node to run the command `date` and see what it gives.

Note that debug node output can be confusing as it displays using the timezone of the browser.

---

<div class="post-metadata">

**Author:** ![muggins](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/muggins/32/63013_2.png) [@muggins](https://discourse.nodered.org/u/muggins)\
**Post date:** [17 May 2024 11:07 UTC](https://discourse.nodered.org/t/strange-inject-behaviour-giving-wrong-time/88055/4 "2024-05-17T11:07:56Z")

</div>

Thank you both, I get it now. I has set the docker environment variable "TZ=UK" which is wrong and it presumably resorts to UTC. Anyway now sorted.

---

<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:** [31 May 2024 11:08 UTC](https://discourse.nodered.org/t/strange-inject-behaviour-giving-wrong-time/88055/5 "2024-05-31T11:08:49Z")

</div>

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