How To Change TimeZone on Ubuntu 21.04

In this wiki article, we will learn how to change the timezone in Ubuntu 20.04 using the timedatectl command.

To check your current TimeZone

To get detailed information your Ubuntu date, time, and timezone you use the timedatectl command.

timedatectl

Output:

root@vps:~# timedatectl
               Local time: Thu 2021-04-29 06:01:54 UTC
           Universal time: Thu 2021-04-29 06:01:54 UTC
                 RTC time: Thu 2021-04-29 06:01:54
                Time zone: Etc/UTC (UTC, +0000)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

The TimeZone configuration on Ubuntu OS is stored set by the /etc/localtime file. This file is actually a symbolic link to a timezone file under /usr/share/zoneinfo.

To get a basic view of the timezone you can ls the file to it’s symbolic link.

ls -l /etc/localtime

Output:

root@vps:~# ls -l /etc/localtime
lrwxrwxrwx 1 root root 27 Apr 29 01:33 /etc/localtime -> /usr/share/zoneinfo/Etc/UTC

The system’s timezone in also written to the /etc/timezone file.

cat /etc/timezone

Output:

root@vps:~# cat /etc/timezone
Etc/UTC

Listing TimeZones

Using timedatectl command to list TimeZones,

timedatectl list-timezones

Output:

root@vps:~# timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Algiers
Africa/Bissau
Africa/Cairo
Africa/Casablanca
Africa/Ceuta
Africa/El_Aaiun
Africa/Johannesburg
Africa/Juba
Africa/Khartoum
.....

Set your Preferred TimeZone

Once you have the list of timezones, you can set the one you prefer.

timedatectl set-timezone your_time_zone

Example:

root@vps:~# timedatectl set-timezone America/New_York

To confirm your changes were applied by running the timedatactl command.

timedatectl

Output:

root@vps:~# timedatectl
               Local time: Thu 2021-04-29 02:04:22 EDT
           Universal time: Thu 2021-04-29 06:04:22 UTC
                 RTC time: Thu 2021-04-29 06:04:22
                Time zone: America/New_York (EDT, -0400)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no