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:
timedatectl list-timezones
RTC Setting
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
{
"type": "unsupported",
"object": "block",
"id": "129f1a97-ddeb-811c-a8cc-cec160062d87",
"created_time": "2024-10-24T07:43:00Z",
"last_edited_time": "2024-10-24T07:43:00Z",
"has_children": false,
"in_trash": false,
"created_by": {
"id": "041aeccd-4487-458d-bd0a-b394868bbf29",
"object": "user"
},
"last_edited_by": {
"id": "041aeccd-4487-458d-bd0a-b394868bbf29",
"object": "user"
},
"parent": {
"page_id": "129f1a97-ddeb-8126-ab2d-fee38e5fc5ec",
"Type": "page_id"
}
}
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
Other Settings
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