Compute Engine Google Cloud

How to Change Timezone on Ubuntu 20.04

How to Change Timezone on Ubuntu 20.04. In this guide you are going to learn how to configure or setup your own timezone on Ubuntu server.

Having a local time is necessary on your server for some cronjob or any system related processes. By default, when a server is provisioned a default timezone will get configured automatically with the Coordinated Universal Time (UTC). You can change the timezone later using the below method.

Here you will learn how to use the timedatectl command to change timezone.

Prerequisites

Access to server using root or user who has sudo privileges.

Check Current Timezone

To check the configured time zone that your server uses currently you can use the following command on your Ubuntu 20.04 machine.

timedatectl

You will get an output similar to the one below.

Output
               Local time: Wed 2020-07-22 08:08:33 UTC
           Universal time: Wed 2020-07-22 08:08:33 UTC
                 RTC time: Wed 2020-07-22 08:08:34
                Time zone: Etc/UTC (UTC, +0000)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

Now the time zone configured is UTC.

The system timezone is configured by creating a symbolic link of /etc/localtime to a binary timezone identifier in the /usr/share/zoneinfo directory.

You can also view the timezone by viewing the timezone file created inside the etc directory.

cat /etc/timezone
Output
Etc/UTC

Change Timezone in Ubuntu

Now you can proceed to change the default timezone to your location. The time zones in Ubuntu uses the “Region/City” format.

So, you need to find your region and city using the list-timezones option with the timedatectl command.

timedatectl list-timezones

This command outputs all the available time zones.

Output
Africa/Abidjan
Africa/Accra
Africa/Algiers
Africa/Bissau
Africa/Cairo
. . .

Press Enter to load additional available time zones.

Once you have found your time zone you use the below format to setup your own time zone.

sudo timedatectl set-timezone your_time_zone

If your time zone is America/Los_Angeles, your format should be like this

sudo timedatectl set-timezone America/Los_Angeles

Now you can again use the timedatectl command to confirm the time zone update.

Output
               Local time: Wed 2020-07-22 01:51:43 PDT
           Universal time: Wed 2020-07-22 08:51:43 UTC
                 RTC time: Wed 2020-07-22 08:51:44
                Time zone: America/Los_Angeles (PDT, -0700)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

That’s all.

Conclusion

Now you have learned how to change time zone in your Ubuntu 20.04 machine.

Thanks for your time. If you face any problem or any feedback, please leave a comment below.

Cloudbooklet builds a large collection of Linux based guides and tutorials on Cloud platforms like Google Cloud, AWS, Azure, DigitalOcean and more

Write A Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

If you find this helpful? Support me!
Buy me a coffee Donation Please buy me a coffee