Jun 15, 2023 4 min read

How to Set or Change Timezone on Ubuntu 20.04

Set or Change Timezone on Ubuntu 20.04 with our step-by-step tutorial. It refers to the setting that determines the local time of a system.

Set or Change Timezone on Ubuntu 20.04
Table of Contents

Choose a different version or distribution

Introduction

Before we discuss how to set or modify the time zone on Ubuntu 20.04, let's briefly understand – What is Timezone?

Timezone on Ubuntu refers to the setting that determines the local time of a system. It helps in synchronizing time-related operations, such as scheduling tasks and displaying accurate timestamps. Ubuntu allows users to set their timezone during installation or later through configuration.

Choosing the correct timezone ensures accurate time representation and facilitates seamless collaboration across different locations. Whether it's for personal use or in a business setting, configuring the timezone on Ubuntu is essential for maintaining accurate time synchronization and avoiding discrepancies in time-sensitive applications.

You will configure or change the Timezone on Ubuntu 20.04 in this tutorial.

Advantages

  1. Accurate Timekeeping: Setting the timezone in Ubuntu ensures accurate representation of local time, facilitating proper scheduling and time-related operations.
  2. Global Collaboration: Properly configured timezones enable seamless collaboration across different locations, enhancing communication and coordination in international teams.
  3. Daylight Saving Time: Ubuntu's timezone support includes automatic adjustments for Daylight Saving Time, eliminating the need for manual adjustments.
  4. System Integration: Timezone settings integrate with various system utilities, applications, and services, ensuring consistent time across the operating system.
  5. Timezone Selection: Ubuntu provides a wide range of timezone options, allowing users to choose the specific region/city to align with their local time accurately.

Prerequisites to Set or Change Timezone on Ubuntu 20.04

1) Ensure that you are logged in as root or as a user with sudo privileges.

Check Current Timezone

1) The timedatectl command on Ubuntu and other Linux distributions can be used to see the time and date of the system:

timedatectl

The output will show that the timezone is set to UTC:

Output

Local time: Thur 2022-12-23 22:45:47 UTC
                  Universal time: Thur 2022-12-23 22:45:47 UTC
                        RTC time: Thur 2022-12-23 22:45:48
                       Time zone: Etc/UTC (UTC, +0000)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no

2) By creating a symbolic link between etc/localtime and a binary timezone identifier in the /usr/share/zoneinfo directory, you can change the system timezone.

ls -l /etc/localtime
Output

lrwxrwxrwx 1 root root 16 August 10 12:59 /etc/localtime -> /usr/share/zoneinfo/Etc/UTC

3) You may also view the information in the /etc/timezone file to determine the current system's timezone:

cat /etc/timezone
Output

Etc/UTC

Changing the Timezone Using timedatectl Command

1) The first step is to identify the lengthy name of the timezone you intend to use. The Region/City format is essentially used for the timezone naming convention.

List the files in the /usr/share/zoneinfo directory, or use the timedatectl command with the list-timezones option to see all time zones that are currently in use:

timedatectl list-timezones
Output

...
Europe/Oslo
Europe/Paris
Europe/Podgorica
Europe/Prague
Europe/Riga
Europe/Rome
Europe/Samara
...

2) Once you have determined which time zone is best for you, use the command below:

sudo timedatectl set-timezone your_time_zone

3) For example, to set Europe/Rome as the system's timezone:

sudo timedatectl set-timezone Europe/Rome

4) Execute the timedatectl command after that. The changes have to be verified by:

timedatectl
Output

Local time: Thur 2022-12-23 00:27:43 CET
                  Universal time: Thur 2022-12-23 23:27:43 UTC
                        RTC time: Thur 2022-12-23 23:27:44
                       Time zone: Europe/Rome (CET, +0100)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no

Changing the Timezone Using GUI

If you are using an Ubuntu Desktop, you can change the Timezone of the machine using the GUI.

1) Click the Settings icon to display the system settings window.

2) Next, select the Date & Time tab from the system settings box. The time zone should be set automatically based on your time zone if the Automatic Timezone is set to ON, you have an internet connection, and location services are enabled.

3) Click on the map or use the search box to look up a time zone if you want to choose a new one.

Click on × to close the window.

FAQs to Set or Change Timezone on Ubuntu 20.04

How do I check the current timezone on Ubuntu 20.04?

Run the command timedatectl show --property=Timezone in the terminal to view the current timezone.

Can I see a list of available timezones on Ubuntu 20.04?

Yes, you can run the command timedatectl list-timezones to display a comprehensive list of available timezones.

How do I set the system time to synchronize with the selected timezone on Ubuntu 20.04?

Ubuntu automatically synchronizes the system time with the selected timezone. No additional steps are required.

Does changing the timezone affect the system's hardware clock on Ubuntu 20.04?

No, changing the timezone does not affect the system's hardware clock. The hardware clock keeps time in UTC (Coordinated Universal Time).

Can I revert to the default timezone on Ubuntu 20.04?

Yes, you can revert to the default timezone by running the command sudo timedatectl set-timezone UTC.

Can I set the timezone for a specific user on Ubuntu 20.04?

Yes, you can set the timezone for a specific user by using the command sudo timedatectl set-timezone [timezone] --user. Replace [timezone] with the desired timezone.

Conclusion

You now know how to set or change the Timezone on Ubuntu 20.04.

If you have any queries, please leave a comment below, and we’ll be happy to respond to them.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to DevOps Tutorials - VegaStack.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.