Using the correct date and time on your Ubuntu system is essential for tasks and processes such as data logging. The system’s timezone is set during the initial setup, but users can still change it. Modern operating systems detect and synchronize time using NIST (National Institute of Standards and Technology) time servers.
How to Set the Timezone on Ubuntu
Most modern Linux distributions such as Fedora, Debian, Ubuntu, Arch, CentOS v.7.x+, and other Unix-based systems provide the timedatectl
utility. Show step-by-step how to set the timezone on Ubuntu 24.04. Make sure to log in as a root user to perform the following actions.
Display Current Date and Time
timedatectl
Sync Time to NIST Atomic Clock
timedatectl set-ntp yes
You can turn off NTP synchronizing with
timedatectl set-ntp no
Change the Time in Ubuntu
timedatectl set-time 11:40:50
The time format is hh:mm:ss (hours, minutes, seconds)
Change the Date in Ubuntu
timedatectl set-time 2024-10-12
The date format is yyyy-mm-dd (Year, Month, Day).
Set a Timezone in Ubuntu
List the names of the time zones
timedatectl list-timezones
Find the location closest to you, then enter the following
Replace Region/Location
with a name from the time zone list.
Set UTC in Ubuntu
timedatectl set-timezone UTC
Hardware Clock to Sync to Local Timezone
timedatectl set-local-rtc 1
Hardware Clock to Sync with UTC
timedatectl set-local-rtc 0