Wednesday, 4 April 2018

very basic post, OEL RHEL change TZ for proper date and time stamps

The little things get to me when I'm troubleshooting, like date and time. 

If I look at the machine and NTP is set up properly but my timestamps are wrong, then generally this is going to be related to TZ. Very simple steps to getting this right for Melbourne: 

 To validate that this is your problem, you can enter the command below: 

It gives you some really cool information about daylight savings and NTP - which you need to know.

[root@ip-10-10-1-235 ~]# timedatectl
      Local time: Tue 2018-04-03 23:24:28 UTC
  Universal time: Tue 2018-04-03 23:24:28 UTC
        RTC time: Tue 2018-04-03 23:24:28
       Time zone: n/a (UTC, +0000)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a

Okay, this needs to be fixed!  See how there is no information about DST or TZ

One simple command as root

ln -sf /usr/share/zoneinfo/Australia/Melbourne /etc/localtime

Then viola!

[root@ip-10-10-1-235 ~]# timedatectl
      Local time: Wed 2018-04-04 09:21:07 AEST
  Universal time: Tue 2018-04-03 23:21:07 UTC
        RTC time: Tue 2018-04-03 23:21:06
       Time zone: Australia/Melbourne (AEST, +1000)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: no
 Last DST change: DST ended at
                  Sun 2018-04-01 02:59:59 AEDT
                  Sun 2018-04-01 02:00:00 AEST
 Next DST change: DST begins (the clock jumps one hour forward) at
                  Sun 2018-10-07 01:59:59 AEST
                  Sun 2018-10-07 03:00:00 AEDT

Cool, and yes - DST did change on Sunday.  Nice reminder. 

 You can work out your own settings from this example.

No comments:

Extending JDE to generative AI