How to set Timezone on Ubuntu Server
2024-06-14
Today I had to setup the timezone on a couple of Ubuntu servers. I thought it would be a good idea to write a short article about it. So here we go 🤓
Setting the timezone on Ubuntu is pretty easy. You can do it with the timedatectl
command.
First you should check the current timezone with the following command:
timedatectl
# output - look for "Time zone"
Local time: Sa 2024-06-01 01:06:51 CEST
Universal time: Fr 2024-05-31 23:06:51 UTC
RTC time: Sa 2024-06-01 01:06:51
Time zone: Europe/Vienna (CEST, +0200)
System clock synchronized: yes
NTP service: active
RTC in local TZ: yes
In this case the timezone is set to Europe/Vienna
. If you want to change it you can do it with the following command:
sudo timedatectl set-timezone Europe/Berlin
After that you should see the new timezone with the timedatectl
command:
timedatectl
# output - look for "Time zone"
Local time: Sa 2024-06-01 01:09:32 CEST
Universal time: Fr 2024-05-31 23:09:32 UTC
RTC time: Sa 2024-06-01 01:09:32
Time zone: Europe/Berlin (CEST, +0200)
System clock synchronized: yes
NTP service: active
RTC in local TZ: yes
If you are not sure what timezone you can get a list of available timezones with the following command:
timedatectl list-timezones
That's it. Now you know how to set the timezone on an Ubuntu server 🎉