How to check and change time zone on CentOS 7 & 8

On CentOS, the system time zone is set during installation, but can easily be changed afterwards. This article describes how to set or change the time zone on a CentOS 7 & 8 system.

1.Check current time zone

timedatectl is a command-line utility that allows you to view and change the system’s time and date. It is available on all modern systemd-based Linux systems:

$ timedatectl

The output shows the system’s timezone. In this example the timezone is set to America/Toronto :

The system timezone is configured by symlinking /etc/localtime to a binary timezone identifier in the /usr/share/zoneinfo directory. Another option to check the timezone is to show the path the symlink points to using the ls command:

$ ls -l /etc/localtime

lrwxrwxrwx. 1 root root  August 27 2021/etc/localtime >../usr/share/zoneinfo/America/Toronto

2. Changing Timezone in CentOS

Before changing the timezone, you’ll need to find out the long name for the timezone you want to use. The timezones are using “Region/City” format.

To list all available time zones invoke the timedatectl command with the list-timezones option:

 $ timedatectl list-timezones


Once you identify which time zone is accurate to your location, run the following command as root or user with sudo privileges :

$ timedatectl set-timezone your_time_zone

For example, to change the system’s timezone to America/Phoenix

$ timedatectl set-timezone America/Phoenix

After run the timedatectl command to verify the changes: