# Coordinated Universal Time to Z time

**URL:** <https://discourse.nodered.org/t/coordinated-universal-time-to-z-time/43229>\
**Category:** General\
**Created:** [26 March 2021 09:16 UTC](https://discourse.nodered.org/t/coordinated-universal-time-to-z-time/43229 "2021-03-26T09:16:59Z")\
**Posts on this page:** 16\
**Page:** 2

<div class="post-metadata">

**Author:** ![ScheepersJohan](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/scheepersjohan/32/39556_2.png) [@ScheepersJohan](https://discourse.nodered.org/u/ScheepersJohan)\
**Post date:** [27 March 2021 21:17 UTC](https://discourse.nodered.org/t/coordinated-universal-time-to-z-time/43229/21 "2021-03-27T21:17:18Z")

</div>

I feed it to the db in Z time.

When I read it from the db I add 2, as my time zone is GMT+2.

The catch is worldmap now displays the GMT+2 as Z time.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/7/7753756efb26744b73585ab44656a1abac704458.png)

---

<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:** [27 March 2021 21:25 UTC](https://discourse.nodered.org/t/coordinated-universal-time-to-z-time/43229/22 "2021-03-27T21:25:15Z")

</div>

I don't use worldmap, but I would have expected it to need UTC. I may be wrong though.

I thought the discussion earlier was to get round the fact that mysql expects timestamps in local time.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [27 March 2021 22:10 UTC](https://discourse.nodered.org/t/coordinated-universal-time-to-z-time/43229/23 "2021-03-27T22:10:53Z")

</div>

The worldmap just plots points on a map. It has no concept of time. So saving it in the database as UTC then fixing it for display is the right thing to do

---

<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:** [27 March 2021 22:15 UTC](https://discourse.nodered.org/t/coordinated-universal-time-to-z-time/43229/24 "2021-03-27T22:15:45Z")

</div>

Oh, is it just text you are displaying? I hadn't realised that.

---

<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:** [28 March 2021 08:47 UTC](https://discourse.nodered.org/t/coordinated-universal-time-to-z-time/43229/25 "2021-03-28T08:47:39Z")

</div>

> [@dceejay](#):
>
> So saving it in the database as UTC then fixing it for display is the right thing to do

The complication is, as I understood it, that MySQL apparently expects a timestamp in local time, which it converts to UTC to save in the database. For TIMESTAMP columns at least.

---

<div class="post-metadata">

**Author:** ![mrdvt92](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mrdvt92/32/33122_2.png) [@mrdvt92](https://discourse.nodered.org/u/mrdvt92)\
**Post date:** [30 March 2021 19:48 UTC](https://discourse.nodered.org/t/coordinated-universal-time-to-z-time/43229/26 "2021-03-30T19:48:33Z")

</div>

Except there are multiple GMTs (one that using daylight time) so don't use GMT if you mean UTC.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [30 March 2021 20:11 UTC](https://discourse.nodered.org/t/coordinated-universal-time-to-z-time/43229/27 "2021-03-30T20:11:18Z")

</div>

No, there is only 1 GMT. The DST variant is called BST (British summer time). As I said, Z=GMT=UTC.

For example, I live in the Europe/London tz. The base timezone is GMT and the DST variant that we have just entered is BST.

Time is **COMPLEX**!

---

<div class="post-metadata">

**Author:** ![ScheepersJohan](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/scheepersjohan/32/39556_2.png) [@ScheepersJohan](https://discourse.nodered.org/u/ScheepersJohan)\
**Post date:** [30 March 2021 20:16 UTC](https://discourse.nodered.org/t/coordinated-universal-time-to-z-time/43229/28 "2021-03-30T20:16:01Z")

</div>

The time is stored in AWS RDS that works in Z = Zulu = UTC = GMT.

I am at Z = Zulu = UTC = GMT (+02:00) (we don't have daylight saving (daylight time), and we are south of the equator)

I and recalling the time and adding +02:00 to it (Z+02:00) (@Colin thank you)

The map takes it just as text and don't know it been corrected t o UCT+02:00.

Trying to see if there were a way the map will display it as GMT+02:00, as it shows it as Z not realizing the correction in time zone.

Time is very complex @TotallyInformation if your bd is in one time zone and you in another.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [30 March 2021 20:23 UTC](https://discourse.nodered.org/t/coordinated-universal-time-to-z-time/43229/29 "2021-03-30T20:23:10Z")

</div>

> [@ScheepersJohan](#):
>
> Time is very complex @TotallyInformation if your bd is in one time zone and you in another.

Haha, time is complex no matter what, I think I mentioned that just before you did. That's one of the reasons I wrote the moment node. 🙂

---

<div class="post-metadata">

**Author:** ![mrdvt92](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mrdvt92/32/33122_2.png) [@mrdvt92](https://discourse.nodered.org/u/mrdvt92)\
**Post date:** [30 March 2021 20:33 UTC](https://discourse.nodered.org/t/coordinated-universal-time-to-z-time/43229/30 "2021-03-30T20:33:30Z")

</div>

I set the time zone in the Systemd configuration and Node-Red time just seems to work correctly for me. Do you have that set?

$ cat /etc/systemd/system/nodered.service.d/override.conf  
[Service]  
Environment="TZ=America/New\_York"  
Environment="NODE\_TLS\_REJECT\_UNAUTHORIZED=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:** [30 March 2021 20:34 UTC](https://discourse.nodered.org/t/coordinated-universal-time-to-z-time/43229/31 "2021-03-30T20:34:27Z")

</div>

In fact, much to my surprise, it seems that @mrdvt92 is correct. Strictly GMT is not necessarily the same as UTC. It can be up to 0.9 seconds out apparently. See [Greenwich Mean Time - Wikipedia](https://en.wikipedia.org/wiki/Greenwich_Mean_Time)

---

<div class="post-metadata">

**Author:** ![ScheepersJohan](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/scheepersjohan/32/39556_2.png) [@ScheepersJohan](https://discourse.nodered.org/u/ScheepersJohan)\
**Post date:** [30 March 2021 20:45 UTC](https://discourse.nodered.org/t/coordinated-universal-time-to-z-time/43229/32 "2021-03-30T20:45:45Z")

</div>

@mrdvt92 will have to look maybe I can set it in EC2 on AWS without causing havoc (as my Node-red and RDS (MySQL DB) runs on AWS)

@Colin See from your post GMT is not quit equal to Z, I will need to do some additional reading here, fascinating.

---

<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:** [30 March 2021 20:48 UTC](https://discourse.nodered.org/t/coordinated-universal-time-to-z-time/43229/33 "2021-03-30T20:48:57Z")

</div>

> [@ScheepersJohan](#):
>
> Trying to see if there were a way the map will display it as GMT+02:00, as it shows it as Z not realizing the correction in time zone.

You should not be thinking about adding 2 hours to it, you should be thinking about displaying it in local time. If you look at the docs for javascript Date you will see there are methods for getting the components in local time, or you can use the moment node or node-red-contrib-simple-time or JSONata in a Change node, I believe, though JSONata is not my strong suit.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [30 March 2021 20:52 UTC](https://discourse.nodered.org/t/coordinated-universal-time-to-z-time/43229/34 "2021-03-30T20:52:14Z")

</div>

Drat, that explains why I sometimes miss a famously precise British Railways train!!!! I will adjust my watch accordingly.

---

<div class="post-metadata">

**Author:** ![ScheepersJohan](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/scheepersjohan/32/39556_2.png) [@ScheepersJohan](https://discourse.nodered.org/u/ScheepersJohan)\
**Post date:** [31 March 2021 13:44 UTC](https://discourse.nodered.org/t/coordinated-universal-time-to-z-time/43229/35 "2021-03-31T13:44:18Z")

</div>

I update my EC2 to be on UTC+02:00

So now the EC2 takes the timestamp from the RDS and subtract 02:00. So now it is 4 hours behind.

For information only  
_ **EC2 to Ubuntu** _

> date

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

Setting time zone run

> sudo dpkg-reconfigure tzdata

and follow the prompts.

---

<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:** [14 April 2021 13:45 UTC](https://discourse.nodered.org/t/coordinated-universal-time-to-z-time/43229/36 "2021-04-14T13:45:15Z")

</div>

Closed on 14 April 2021 13:45 UTC

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

[Previous page](https://discourse.nodered.org/t/coordinated-universal-time-to-z-time/43229.md?page=1)
