Centos 7 date displaying current time with plus sign

0

I am facing some problems. Currently i'm using centos 7, and i want to correct the date. I already set the timezone to 'Asia/Kuala_Lumpur', but i get the date with the plus sign. Eg: Tue 2019-04-16 04:54:54 +08

My question is, how do i get my timezone time without the +08?

WHen i run command timedatectl, i get the following:

      Local time: Tue 2019-04-16 04:54:54 +08
  Universal time: Mon 2019-04-15 20:54:54 UTC
        RTC time: Mon 2019-04-15 20:54:54
       Time zone: Asia/Kuala_Lumpur (+08, +0800)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: no
      DST active: n/a

I already try to setup ntp so that it will sync, but i think because of the firewall at my company, it cannot connect with the ntp server here at asia.

Please help me

maximran

Posted 2019-04-16T03:59:51.027

Reputation: 3

If your company blocks external NTP access, are you sure it doesn't have its own NTP server? Accurate clock is usually considered quite important for infrastructure and it's odd that it would be completely blocked. – user1686 – 2019-04-16T05:12:53.583

Answers

1

This is normal. The last word following the date & time is usually the timezone abbreviation, so you would usually see names such as "EST" or "CET" in this position.

           Local time: Tue 2019-04-16 07:33:37 EEST
       Universal time: Tue 2019-04-16 04:33:37 UTC
             RTC time: Tue 2019-04-16 04:33:38
            Time zone: Europe/Vilnius (EEST, +0300)

However, Asia/Kuala_Lumpur in the tzdata archive does not have an alphabetic timezone abbreviation – your timezone is literally named just "+08" in the data file.

(You can see this in the source on GitHub, as well as the compiled data file on your system by running zdump -v Asia/Kuala_Lumpur.)

# Zone  NAME            GMTOFF  RULES   FORMAT  [UNTIL]
Zone Asia/Kuala_Lumpur  6:46:46 -       LMT     1901 Jan  1
                        6:55:25 -       SMT     1905 Jun  1 # Singapore M.T.
                        7:00    -       +07     1933 Jan  1
                        7:00    0:20    +0720   1936 Jan  1
                        7:20    -       +0720   1941 Sep  1
                        7:30    -       +0730   1942 Feb 16
                        9:00    -       +09     1945 Sep 12
                        7:30    -       +0730   1982 Jan  1
                        8:00    -       +08

user1686

Posted 2019-04-16T03:59:51.027

Reputation: 283 655

If that is the normal, does that means that if i want to correct the time, i just run the command to change the current time? "timedatectl set-time [HH:MM:SS]" and just ignore the +0800?, as it only a name format? – maximran – 2019-04-16T04:59:36.180

Yes. Both timedatectl set-time and date --set="..." accept simple local H:m:s time. (Note that the system internally works with UTC (GMT) times, so it's more important for "Universal time" to be correct.) – user1686 – 2019-04-16T06:59:42.773