How To: Set Time Zone in Linux
You’ve got yourself a system running Linux, whether it’s for everyday desktop use or maybe a command line only setup on a server. Whatever the case may be, you might notice the time is often hours off. Even after correcting it, you come back and find the time is incorrect again. This could be because the time zone is set incorrectly.
Time Zone Setting
To set the timezone, run (in terminal where a GUI is in use):
sudo timedatectl set-timezone Country/City
sudo systemctl restart systemd-timesyncd
Country/City with the details for the time zone you would like to set.
To see a list of available time zones to choose from, run:
Another settings to check include whether the time is set to expect RTC (Real Time Clock) from the hardware clock. This could mean your Linux system is adjusting the time for your configured time zone from the date and time set in your hardware.
To disable RTC being referenced and used with your hardware, run (in terminal where a GUI is in use):
sudo timedatectl set-local-rtc false
To enable RTC being referenced and used with your hardware, run (in terminal where a GUI is in use):
sudo timedatectl set-local-rtc true
If you are finding your time is only a little bit off, say minutes or even seconds, you may need to setup something to keep time in sync. This would usually be NTP (Network Time Protocol) but that is a story for another day - or time as the case may be.
Tested on Ubuntu Server Linux 22.04