How to Change TimeZone on Debian 11
In this wiki article, we will learn how to change the TimeZone in Debian 11 using the timedatectl
command.
Check your current TimeZone
To get detailed information on your Debian date, time, and timezone you use the timedatectl command.
timedatectl
Output:
root@server:~# timedatectl
Local time: Tue 2021-08-03 23:59:13 IST
Universal time: Tue 2021-08-03 18:29:13 UTC
RTC time: Tue 2021-08-03 18:29:14
Time zone: Asia/Kolkata (IST, +0530)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
The TimeZone configuration on Debian 11 OS is stored set by the /etc/localtime
file. This file is a symbolic link to a timezone file under /usr/share/zoneinfo
.
To get a basic view of the timezone you can ls the file to its symbolic link.
ls -l /etc/localtime
Output:
root@server:~# ls -l /etc/localtime
lrwxrwxrwx 1 root root 32 Aug 3 19:01 /etc/localtime -> /usr/share/zoneinfo/Asia/Kolkata
The system’s timezone is also written to the /etc/timezone file.
cat /etc/timezone
Output:
root@server:~# cat /etc/timezone
Asia/Kolkata
Listing TimeZones
Using timedatectl
command to list TimeZones,
timedatectl list-timezones
Output:
root@server:~# timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Algiers
Africa/Bissau
Africa/Cairo
Africa/Casablanca
Africa/Ceuta
Africa/El_Aaiun
Africa/Johannesburg
Africa/Juba
Africa/Khartoum
Africa/Lagos
.....
Set your Preferred TimeZone
Once you have the list of timezones, you can set the one you prefer.
timedatectl set-timezone your_time_zone
Example:
root@server:~# timedatectl set-timezone Africa/Abidjan
To confirm your changes were applied by running the timedatactl command.
timedatectl
Output:
root@server:~# timedatectl
Local time: Tue 2021-08-03 18:32:46 GMT
Universal time: Tue 2021-08-03 18:32:46 UTC
RTC time: Tue 2021-08-03 18:32:47
Time zone: Africa/Abidjan (GMT, +0000)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no