Set Timezone correctly in CentOS 7

Every time after you finished install a fresh copy of Linux, it will give you UTC-0, so you need to set the timezone to make your software run correctly, like log with correct date.

Check current date time in Linux

# date
Tue Apr 28 16:24:45 EDT 2020

List current support timezones in Linux

# timedatectl list-timezones

Set the timezone

Choose one fo the timezone from the timedatectl list-timezones above.

sudo timedatectl set-timezone Asia/Bangkok

Verify your timezone using timedatectl

# timedatectl
      Local time: Wed 2020-04-29 03:29:57 +07
  Universal time: Tue 2020-04-28 20:29:57 UTC
        RTC time: Tue 2020-04-28 20:29:57
       Time zone: Asia/Bangkok (+07, +0700)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a

Check the current timezone again, so it will be showing +07 then the timezone is correct.

# date
Wed Apr 29 03:28:00 +07 2020

Tags:

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Exit mobile version