How to Set or Change Timezone on Ubuntu 24.04

Choose a different version or distribution

Introduction

Before we begin talking about steps to set or change Timezone on Ubuntu 24.04, let's briefly understand – What is a Timezone?

Timezone in Ubuntu Linux serves to adjust the system clock to match a particular geographical region. Configuring Timezone on Ubuntu is crucial for accurate time management on your computer.

By setting the correct timezone, your system can display the exact time based on your location, ensuring synchronization with global time standards. Understanding Timezone Ubuntu allows users to stay organized and avoid confusion with time-related functions on their Ubuntu system.

In this tutorial, you will set or change the Timezone on Ubuntu 24.04. We will also address a few FAQs on how to set or change Timezone on Ubuntu 24.04.

How to Set or Change the Time Zone on Ubuntu 24.04

Here are the methods to set or change the time zone on Ubuntu:

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

The following sections illustrate these methods.

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 using the system settings (GUI), follow these steps:

Step 1. Open Date & Time Settings by navigating through Activities > Settings > System > Date & Time

Step 2: In the Date & Time Settings, click on the Time Zone to change it.

This will bring up the Select Time Zone prompt, where you can search for and select the city you want to sync your time with.

Bonus Tip: Set Automatic Time Zone on Ubuntu 24.04

Ubuntu 24.04 uses the "geoclue" service to determine your current location and automatically set the time zone. If you have enabled location services and have internet access, you can activate the automatic time zone feature based on your location. To enable this, toggle the Automatic Time Zone option in the Date & Time settings, as shown below:

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

The timedatectl command, a part of systemd, allows you to view and manage the system's time. You can also use timedatectl to change the time zone, as demonstrated in the following steps:

Step 1: View Current Time Zone

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

timedatectl

Step 2: List Time Zones

Next, list the available time zones by running the following command:

timedatectl list-timezones

You can also display the time zone for a specific city, such as Kolkata, using the following command:

timedatectl list-timezones | grep -i kolkata

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

To set or change the time zone (e.g., to America/Chicago) on Ubuntu 24.04, run the following commands and then verify the changes:

sudo timedatectl set-timezone America/Chicago
timedatectl

Note: If your city isn't listed among the time zones, select the nearest city, as time zones cover broader regions.

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

The tzdata command-line utility, still available in Ubuntu 24.04, allows you to configure the system's time zone. To use it, run the following command and select the geographic area to narrow down the list of cities from which you can set the time zone:

sudo dpkg-reconfigure tzdata

Next, select the city or region for which you want to set or change the time zone:

Once completed, it will display 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 an interactive script that prompts the user to configure the time zone effectively. Here is the script:

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

The script, named script.sh, prompts for the region where the desired time zone is located when run. To execute the script, use the following command:

bash script.sh

After selecting the region, you will need to choose the country for which you want to set the time zone:

Confirm the changes by typing "Yes" and, when prompted to "Enter a number in range", enter 1:

That’s all you need to do to set or change the time zone on Ubuntu 24.04.

FAQs to Set or Change Timezone on Ubuntu 24.04

What command is used to change the timezone in the terminal? 

The timedatectl command is commonly used to set or change the timezone in Ubuntu.

How do I use the timedatectl command?

You can change the timezone by executing sudo timedatectl set-timezone <Your/Timezone> in the terminal.

What happens if I set the timezone incorrectly? 

An incorrect timezone can lead to inaccurate timestamps for files and scheduled tasks.

What is the format for specifying a timezone? 

The format is typically <Region>/<City>, such as Asia/Calcutta.

What is the difference between UTC and local time?

UTC (Coordinated Universal Time) is a time standard, while local time is the time based on your specific timezone.

How can I manually edit the /etc/timezone file? 

You can edit it using a text editor with the command sudo nano /etc/timezone.

What is the effect of changing the timezone on scheduled tasks? 

Scheduled tasks may execute at different local times if the timezone is changed.

Conclusion

We hope this detailed guide helped you to set or change the timezone on Ubuntu 24.04.

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