Learning Ubuntu: Set Timezone (3 Easy Methods)

Learning Ubuntu: Set Timezone (3 Easy Methods)

Using the correct date and time on your Ubuntu system is essential for tasks and processes such as data logging, cron jobs, and the overall management of a Linux-based virtual private server.

Most applications also use the timezone to manage their data accordingly. When it comes to Ubuntu, the system’s timezone is set during the initial setup, but users can still change it.

This article will discuss how to set a timezone in Ubuntu using three easy methods. Refer to our other guide if you’re looking to change timezone on CentOS.

How to Set the Timezone on Ubuntu

In this section, we will show step-by-step how to set the timezone on Ubuntu so you can better manage your Linux VPS. Make sure to log in as a root user to perform the following actions.

Using the Graphical User Interface (GUI)

The most convenient way to change the timezone on an Ubuntu system is via the graphical user interface (GUI). Since it is accessible from the desktop, users don’t have to run any commands.

Here’s how to change the timezone using the GUI – the instructions are applicable for Ubuntu 18.04, Ubuntu 20.04, and Ubuntu 22.04:

  1. Click on the System menu on the top-right corner of the screen.
  2. Select Settings and go to the Date & Time tab.
The Date and Time menu of Ubuntu desktop
  1. Turn the Automatic Time Zone option to OFF. If it is ON and the system is connected to the internet, it will automatically set the timezone according to the user’s location.
The Automatic Date and Time option turned off
  1. Click on Time Zone.
The date and time menu of Ubuntu with the time zone option highlighted
  1. A new window will open. Select the new timezone by clicking on the map directly or using the search bar.
Ubuntu's Time Zone map display
  1. Once done, click on the x button to close the window.

Check the Time Zone box inside the Date & Time tab to verify if the new timezone and current date were successfully updated.

Date Time and Time Zone in Ubuntu desktop changed

Using timedatectl (via the Command Line)

There are two ways to set up a server’s timezone in the command line – using tzselect or timedatectl. However, the first command only works to change the timezone temporarily.

If you opt for tzselect, the timezone will revert to the one set in the /etc/timezone file after a reboot. You can still use this command as an alternative way to list the timezone options on the system.

To do so, open Terminal or your command-line interface (CLI) and run the tzselect command. Then, specify the desired timezone and press Enter.

List timezones option on Ubuntu terminal

One of the best methods to permanently change the timezone on Ubuntu is using the timedatectl command. It is a Linux utility that allows users to review and change the configuration of the system clock.

In addition, the timedatectl command enables users to modify the system’s current time and date, set a timezone, and automatically synchronize the clock via a remote server. We recommend it if your machine is running Ubuntu 18.04, Ubuntu 20.04, or Ubuntu 22.04.

Here’s how to change the timezone using this method:

  1. Open your CLI. Check the current system’s timezone by running the timedatectl command.
  1. The output below shows that the local time is set to Coordinated Universal Time (UTC).
Output showing that the system's local timezone is set to UTC
  1. Find out the full name of the timezone. Usually, the naming convention uses the Region/City format. Insert the command below to see the timezone list:
timedatectl list-timezones
List of timezones on Ubuntu terminal
  1. Alternatively, combine the timedatectl command with the grep command to filter the search using the name of a city.
timedatectl list-timezones | grep Paris
  1. Press CTRL + C to exit.
  2. Once you have decided which timezone to select, run the following command to make the change. Note that it will not produce any output:
sudo timedatectl set-timezone [timezone]
  1. Insert the command below and press Enter to verify the update:
timedatectl

The time zone and system clock synchronized values show that the new local time was updated successfully.

Using the tzdata Command (Older Ubuntu Versions)

Users of Ubuntu versions such as 16.04 or lower can set their timezones by reconfiguring the timezone and daylight saving time data or tzdata. It contains files documenting both current and historical transitions of time zones around the world.

Follow these steps to change the timezone using the tzdata command:

  1. Type in the following command to reconfigure tzdata and press Enter:
sudo dpkg-reconfigure tzdata
  1. The package configuration window will open. Choose your geographic area and press Enter.
The tzdata interface with geographic areas shown
  1. Select OK, and press Enter.
  2. Next, select the city or region corresponding to the timezone.
List of available timezones using tzdata
  1. Select OK and hit Enter.
  2. An output will automatically appear to ensure your current timezone was set correctly.
Current default time zone updated to Europe/Paris

You can also find your Linux system’s timezone information in the /etc/timezone directory.

Conclusion

Using the correct timezone is important for a system’s processes, as it defines when those tasks will be deployed and done. On Ubuntu, users usually set up the system clock during the initial installation.

However, the current timezone is adjustable using three easy methods – the graphical user interface (GUI), the timedatectl command, or the tzdata command.

If you use Ubuntu 18.04, Ubuntu 20.04, or Ubuntu 22.04, we recommend the GUI method or the timedatectl command. For Ubuntu 16.04 and lower, we recommend reconfiguring tzdata.

We hope this article has helped you set up the timezone on your Ubuntu system. If you have any questions or suggestions, leave them in the comments section below.

Author
The author

Edward S.

Edward is a Content Editor with years of experience in IT as a writer, marketer, and Linux enthusiast. Edward's goal is to encourage readers to establish an impactful online presence. He also really loves dogs, guitars, and everything related to space.