Coordinated Universal Time to Z time

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.

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.

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

1 Like

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

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.

1 Like

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

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!

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.

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. :slight_smile:

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

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

1 Like

@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.

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.

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

1 Like

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



Setting time zone run

sudo dpkg-reconfigure tzdata

and follow the prompts.

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