The time zone is directly related to the Earth’s rotation and this is the reason why the time zones are different. Having an accurate time zone on your devices ensures proper timestamps, logging, and proper working of the scheduled tasks. 

If you are planning to move to a different location, it is necessary to change your time zone. It is the most important task that you must do especially while using Ubuntu 24.04 to make sure everything is clear when viewing the log files or running the cron jobs. The Time Zone set is system-wide and individual users cannot have separate time zones on a system.

Today’s guide explores the methods to set or change the time zone on Ubuntu 24.04.

How to Set or Change the Time Zone on Ubuntu 24.04

You can set or change the time zone on Ubuntu via the following methods:

  • Using the System Settings or GUI
  • Using the “timedatectl” Command
  • Configuring the “tzdata”

The above methods are illustrated as follows.

Method 1: Set or Change the Time Zone on Ubuntu 24.04 Using the System Settings or GUI

To set or change the time zone on Ubuntu 24.04 via the system settings (GUI), follow these steps:

Step 1: Open Date & Time Settings from the Activities ? Settings ? System ? Date & Time:

Step 2: Change the Time Zone from the Date & Time Settings by clicking on it:

It now brings up the Select Time Zone prompt and from here, you can search the cities with whom you want to sync your time:

Bonus Tip: Set Automatic Time Zone on Ubuntu 24.04

Ubuntu 24.04 uses the “geoclue” service to determine the current location and set the time zone accordingly. If you have enabled location and internet access, you can set the automatic time zone based on your current location. To do that, toggle the Automatic Time Zone option in the Date & Time settings, as seen below:

Method 2: Set or Change the Time Zone on Ubuntu 24.04 Using the “timedatectl” Command

The “timedatectl” command is a part of systemd that lets you view the system’s time and manage it. You can use the “timedatectl” to change the time zone as well, as illustrated in the below steps:

Step 1: View Current Time Zone

Before changing the time zone, check the current time zone first using the following command:

timedatectl

Step 2: List Time Zones

Now, list the time zones to choose from by executing the following command:

timedatectl list-timezones

Additionally, you can list the time zone for a specific city, e.g. Chicago, as seen below:

timedatectl list-timezones | grep -i chicago

Step 3: Set or Change the Time Zone on Ubuntu 24.04

Here, execute the below-mentioned commands to set or change the time zone (to America/Chicago in this case) on Ubuntu 24.04 and then verify the changes:

sudo timedatectl set-timezone America/Chicago
timedatectl

Note: If you cannot find your city in the time zone, choose the nearest city as the time zones span over a broader region.

Method 3: Set or Change the Time Zone on Ubuntu 24.04 Using the “tzdata” Command

The “tzdata” is a legacy command-line utility that is also available in Ubuntu 24.04. It lets you configure the time zone on your system. To use it, execute the following command and choose the geographic area to narrow a list of cities from which you want to set the time zone:

sudo dpkg-reconfigure tzdata

Now choose the city or the region to whom you want to set or change the time zone:

Once done, it displays the currently set time zone on the terminal screen:

Bonus Tip: Set or Change the Time Zone on Ubuntu 24.04 Using a Script

You can create a user-interactive script that asks the user to configure the time zone smartly. Below is the script:

#!/bin/sh
sudo timedatectl set-timezone $(tzselect)
echo
echo timedatectl says:
timedatectl

The script is named “script.sh and when executed, it asks for the region in which the desired time zone exists. To execute the script, run:

bash script.sh

After selecting the region, you must now choose the country whose time zone you want to select:

Now confirm the changes by entering Yes and when it asks to “Enter a number in range”, enter 1:

That’s all for setting or changing the time zone on Ubuntu 24.04.

Final Words

In Ubuntu 24.04, you can configure the time zone using the System Settings or GUI, the “timedatectl” or “tzdata” command. Additionally, you can use a script to interactively ask the user to specify the time zone they want to change or set. This guide has discussed all the methods to set or change the time zone on Ubuntu 24.04.