Centos/RHEL change timezone from command line

Loading...

To change timezone from command line therefore updating your date & time to a new/correct timezone, follow these steps.

Step 1: Check current datetime & current timezone

Check current datetime

date

#output
Fri May 24 18:45:26 +07 2019

Check current timezone

timedatectl

#output
  Local time: Fri 2019-05-24 18:56:49 ICT
 Universal time: Fri 2019-05-24 11:56:49 UTC
         RTC time: Fri 2019-05-24 11:56:50
        Time zone: Asia/Ho_Chi_Minh (ICT, +0700)
      NTP enabled: yes
 NTP synchronized: yes
  RTC in local TZ: no
       DST active: n/a

Check list of available timezone

timedatectl list-timezones

#output (cut)
 Africa/Abidjan
 Africa/Accra
 Africa/Addis_Ababa
 Africa/Algiers
 Africa/Asmara
 Africa/Bamako
 Africa/Bangui
 Africa/Banjul
 Africa/Bissau
 Africa/Blantyre
 Africa/Brazzaville

Step 2: Update timezone to a new one

Using this command to do

sudo timedatectl set-timezone Africa/Bangui

You can check list of timezones with command above.

After setting new timezone done, your system date time will be updated automatically.

Loading...

Ubuntu change timezone from command line

Loading...

To change timezone from command line therefore updating your date & time to a new/correct timezone, follow these steps.

Step 1: Check current datetime & current timezone

Check current datetime

date

#output
Fri May 24 18:45:26 +07 2019

Check current timezone

cat /etc/timezone

#output
Asia/Bangkok

Step 2: Update timezone to a new one

Using this command to do

sudo dpkg-reconfigure tzdata

A configure screen will display to let you choose your desire timezone

Update timezone to a new one

After selecting new timezone done, your datetime will be updated automatically.

Loading...