How To Set Timezone on Debian 12

Setting a Timezone on Debian or any other operating system is not limited to setting the date and time, but it also affects the working of system applications. Wrong or incorrect time zones can impact the scheduled tasks, network communication, system log files, file timestamps, email timestamps, and more. So whenever installing a new Debian system or changing the system location, setting the timezone is necessary. To set or change the timezone on Debian 12 there are multiple ways like using timdatectl utility. This article will elaborate on setting the Timezone on Debian 12.

5 Ways To Set the Timezone on Debian 12

Timezones are primarily based on geographical locations which standardize time, resulting in making it easy to conduct business, schedule tasks, and more over long distances. There are 5 ways to set a Timezone on Debian:

1: Set Timezone using timedatectl Command

On Debian and other Linux operating systems, there are primarily two types of tools for synchronizing the system clock. One of which is systemd that use the timedatectl command. To view the current Timezone on Debian use timedatectl command:

timedatectl

Checking the current Time zone on Debian using timedatectl command

The first step for setting the timezone on Debian is to list down all the available regions and for that execute the below command:

timedatectl list-timezones

Here, press Enter to keep moving the list and see which timezone relates to your location:

Listing all the time zones available in timedatectl utility on Debian

Since the list is quite long, and it might take a while to go through all, you can add the country filter by using the below syntax:

timedatectl list-timezones | grep -i [desired-timezone-area/country]

Apply region filter for time zones using timedatectl on Debian

Once, you have selected the country and state then use the set-timezone command as in the syntax below:

sudo timedatectl set-timezone [desired-country-and-state]]

Here, I have set my time zone to Saskatchewan, Canada:

Setting Time zone on Debian using timedatectl Utility

Now, you can verify the timezone settings by executing the timedatectl command:

timedatectl

Verifying the change in timedatectl on Debian

2: Set the Timezone Using tzdata Package

The next method to change or set Timezone on Debian 12 is using the tzdata package which is essentially used for timekeeping and time zone management. It contains the IANA Time Zone Database. This database has a vast collection of time zone definitions for various locations around the world. To set the timezone using tzdata execute:

sudo dpkg-reconfigure tzdata

Here, prompt the process by selecting OK after reading the instructions:

Instructions note while setting or changing time zone on Debian using the tzdata

First, select the Geographical area related to your current location and proceed to the next step:

Setting Geographic area for time zone on Debian while changing it using the tzdata package

Next based on the selected geographical area select the relevant city or region corresponding to your time zone and click on OK:

Selecting relevant timezone based on selected geographical area

Once the timezone is selected you will see as in the image below the timezone has been changed:

Setting time zone on Debian using the tzdata package

3: Set Timezone tzselect Menu

The third method to set or change the timezone on Debian 12 is using the tzselect utility, it is a user-friendly tool that allows you to interactively set your Debian timezone. To launch this tool execute the below command:

tzselect

Here, you will see three options for selecting the timezone first is selecting the continent or ocean. The next is using the coordinates(coord) or using the TZ format. Here I have selected the first option, the continent or ocean option:

Setting Time Zone on Debian using tzselect tool

Next, after selecting the ocean or continent, select the desired country:

Setting time zone on Debian by selecting ocean or continent using tzselect tool.

I have selected the Faroe Islands just for illustration and next the confirmation message will appear:

Selecting the country for time zone on Debian and validating it to set time zone using tzselect tool.

Now another prompt will appear asking you to enter a number in the range, so in that case enter 1. Next, you will see an instruction for making the change in timezone permanent:

To make the changes not effected by system reboot add the time zone to profile

To make the change in the timezone permanent add it to the Debian profile by running the following command:

echo "TZ='Atlantic/Faroe'; export TZ" >> ~/.profile

Adding the new time zone to Debian profile so that system reboot doesn't revert it

To verify the timezone change, you can use the timedatectl command:

timedatectl

Verifying the change in Time zone by tzeelect using the timedatectl utility

Alternatively, the second method to set the timezone on Debian is using the tzselect utility by entering the coordinates of the location. Here, first I have selected the coordinate method and then entered the coordinates of the desired region. Next, a list of various regions appeared, from which I had to select the time zone:

Setting time zone on Debian using the coordinate option in tzselect tool by adding location coordinates

Here, I have selected Central Standard Time (CST) and the rest of the process is the same:

Selecting the desired region that comes under the given coordinates on Debian using the tzselect tool.

Another method to set the Time zone using the tzselect utility is selecting the TZ format:

Setting time zone using the TZ environmental variable in tzselect tool on Debian.

4: Using Symlink File for Local Time

The next method to set the timezone on Debian is by manually configuring the local time file. However, before setting the timezone on Debian it is better to list all the states or regions of the desired country:

ls /usr/share/zoneinfo/[Country-Name]/

Here, I have listed all the regions of Canada:

Listing zone info for a specific country on Debian using the local time file database

Next, create a symbolic link for the desired time zone by stating the country and region in the local time file as in the below syntax:

sudo ln -sf /usr/share/zoneinfo/[country/state-or-region] /etc/localtime

Setting the desired Time zone in Debian by symbolic link for it to the local time file.

To verify the changes you can see the permissions, along with the data in the local time file by executing:

ls -l /etc/localtime

Here, you can see the desired country and its region is added:

Verifying the details of local time file for the recent change in Time Zone.

Further, you can also verify the timezone settings by using the timedatectl command:

timedatectl

Verifying the change in Time Zone done by manually writing the local time file on Debian using timedatectl command.

5: Setting Timezone From Date & Time settings

The last method to set or change the timezone on Debian is by using the Date & Time settings under the Debian Settings app. First, unlock the settings:

Unlocking the date and time settings in Debian to set the time zone

Next, click on the Time Zone option :

Setting the Time Zone on Debian using the Time Zone option in Date and Time tab

Next, there are two ways to set the time zone, one is by searching the respective city or country. This method can be a little difficult as you may not find some cities:

Setting the time zone by searching for desired location on Debian

The other way around is directly selecting the region using the map pin, simply click on the desired area on the map to set the time zone on Debian:

Setting time zone on Debian by dropping pin on the world map in time zone settings in date and Time settings.

Next, you will see that the time zone has been changed:

Setting Time Zone on Debian using Time Zone option

Conclusion

To set or change the time zone on Debian 12 there are 5 ways which include using timedatectl command, tzdata package, tzselect tool, manually writing the local time file, and using the Debian Date & Time settings. The best and easiest way to set or change the Time Zone on Debian is using the timedatectl command because you can list different regions and set it to the desired time zone with just one command.

Index
Scroll to Top