# NR & Home Assistant : TZ problem

**URL:** <https://discourse.nodered.org/t/nr-home-assistant-tz-problem/41183>\
**Category:** General\
**Created:** [17 February 2021 17:46 UTC](https://discourse.nodered.org/t/nr-home-assistant-tz-problem/41183 "2021-02-17T17:46:53Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![bennijamm](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bennijamm/32/37420_2.png) [@bennijamm](https://discourse.nodered.org/u/bennijamm)\
**Post date:** [17 February 2021 17:46 UTC](https://discourse.nodered.org/t/nr-home-assistant-tz-problem/41183/1 "2021-02-17T17:46:53Z")

</div>

Hello,  
I am new to Node-Red in Home Assistant.  
I am in France and I would like to have the dates in the format of the country, just like the hours (without AM / PM ...).  
I added this line in the settings.js file:

> process.env.TZ = "Europe / Paris"

But it does not work.  
What should I do ?  
Thank you

---

<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 February 2021 18:33 UTC](https://discourse.nodered.org/t/nr-home-assistant-tz-problem/41183/2 "2021-02-17T18:33:02Z")

</div>

Welcome to the forum. Where do you want to see the timestamps in local time?

---

<div class="post-metadata">

**Author:** ![bennijamm](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bennijamm/32/37420_2.png) [@bennijamm](https://discourse.nodered.org/u/bennijamm)\
**Post date:** [17 February 2021 19:41 UTC](https://discourse.nodered.org/t/nr-home-assistant-tz-problem/41183/3 "2021-02-17T19:41:07Z")

</div>

Hello Colin!  
Thank you for your welcome 🙂  
I would like to see the timestamps in local time in the status of the nodes but especially in the result of the following function:

thank you very much

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/b/bb90a496367cf8fd6b6cce4c798d49312a1c29cc.png)

**Node function :**

> var d = new Date();  
> msg.payload = d.toLocaleString();  
> return msg;

**Log :**  
Here I would like to see: 02/17/2021 20:35:44  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/8/08ec7b80387eab90d7f3b52f2e5561f8453c992c.png)

---

<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 February 2021 19:48 UTC](https://discourse.nodered.org/t/nr-home-assistant-tz-problem/41183/4 "2021-02-17T19:48:21Z")

</div>

Unless the developer of that node provided a method of updating the status you cannot modify it. You can format a string and display whatever you want beneath a function node or debug node only.

---

<div class="post-metadata">

**Author:** ![bennijamm](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bennijamm/32/37420_2.png) [@bennijamm](https://discourse.nodered.org/u/bennijamm)\
**Post date:** [17 February 2021 20:16 UTC](https://discourse.nodered.org/t/nr-home-assistant-tz-problem/41183/5 "2021-02-17T20:16:01Z")

</div>

OK for the status of the node ... too bad!  
And for the toLocaleString () function, any idea?  
Thank you

---

<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 February 2021 20:21 UTC](https://discourse.nodered.org/t/nr-home-assistant-tz-problem/41183/6 "2021-02-17T20:21:33Z")

</div>

You could use the moment nodes or the JSONata node or a function node.

I would favour a function node. There are thousands of examples around the net. Example [tons of ideas in this thread](https://stackoverflow.com/questions/3552461/how-to-format-a-javascript-date).

---

<div class="post-metadata">

**Author:** ![bennijamm](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bennijamm/32/37420_2.png) [@bennijamm](https://discourse.nodered.org/u/bennijamm)\
**Post date:** [17 February 2021 20:24 UTC](https://discourse.nodered.org/t/nr-home-assistant-tz-problem/41183/7 "2021-02-17T20:24:51Z")

</div>

Ok, alright.  
I found someone on the forum talking about the function-npm node. It allows me to use moment () and get at least the hour in HH: MM: SS.  
is that not a problem?

---

<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 February 2021 20:54 UTC](https://discourse.nodered.org/t/nr-home-assistant-tz-problem/41183/8 "2021-02-17T20:54:47Z")

</div>

there is a contrib node called moment that "just works" - no need to code it or npm import moment.

But as i said, i dont use it (too heavy) just concatenate the parts of the data in a function - its not difficult!

or use JSONata.

---

<div class="post-metadata">

**Author:** ![bennijamm](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bennijamm/32/37420_2.png) [@bennijamm](https://discourse.nodered.org/u/bennijamm)\
**Post date:** [17 February 2021 20:58 UTC](https://discourse.nodered.org/t/nr-home-assistant-tz-problem/41183/9 "2021-02-17T20:58:03Z")

</div>

For the moment, I prefer to use Javascript, I find it more understandable than JSONata which I sometimes have trouble understanding ...  
In any case, thank you!

---

<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 February 2021 21:00 UTC](https://discourse.nodered.org/t/nr-home-assistant-tz-problem/41183/10 "2021-02-17T21:00:20Z")

</div>

> [@bennijamm](#):
>
> I prefer to use Javascript, I find it more understandable than JSONata

Same here. JSONata has limited reach and there is an order of magnitude of JavaScript Devs who can help out compared to JSONata.

---

<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 February 2021 21:44 UTC](https://discourse.nodered.org/t/nr-home-assistant-tz-problem/41183/11 "2021-02-17T21:44:56Z")

</div>

You might also find node-red-contrib-simple-time useful. It does many of the simple things that node-red-contrib-moment does but does not have the overheads of the moment module.

---

<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:** [3 March 2021 21:44 UTC](https://discourse.nodered.org/t/nr-home-assistant-tz-problem/41183/12 "2021-03-03T21:44:57Z")

</div>

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