Change Time Zone on CentOS 7

If time zone is wrong on CentOS, you can come across weird issues. One of the things I came cross is Jenkins grabbing a wrong commit. Gotta fix the time zone.

Check the Current Time Zone

ll /etc/localtime

This command shows which time zone the system is set currently.

How to List Available Time Zones

Let’s list the available time zones.

timedatectl list-timezones

It shows quite a long list of time zones. Let’s grep it so you can find the one you want.

timedatectl list-timezones | grep Lo

It lists time zones that contains “Lo”. The time zone I want to use is America/Los_Angeles. I’m going to set the time zone to it.

Change the Time Zone

I’m going to change the time zone to America/Los_Angeles.

sudo timedatectl set-timezone America/Los_Angeles

Execute date command to check the current date, time and time zone.

Thu Oct 31 18:57:05 PDT 2019

Author: admin

A software engineer in greater Seattle area

Leave a Reply

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