Changing Date and Time on Command line Terminal
An Ubuntu system maintains three types of time: hardware, system, and network time.
Hardware time: - The hardware clock provides this time. Computer motherboards come with a pre-installed and configured hardware clock.
System time: - The system clock provides the system time. The operating system installs the system clock during the installation.
Network time: - An NTP server provides the network time. An NTP server offers an accurate and reliable time using an atomic clock.
Key points
- The hardware and system clocks run on the local system. Because of this, you can change or set their date and time.
- NTP servers provide the network time. You can not change it. You can use it to sync the system and hardware times.
- You can manually set hardware and system clocks or configure the system to sync them with the network time. You can use only one option at a time.
The timedatectl command
The timedatectl command displays and changes the date, time, time zone, and related settings. Without any argument or option, it displays these values.
$timedatectl

The output of the above command contains the following information.
Local time: Display the system time in the following format.
Day of the week, date (year-month-day), time (hours: minutes: seconds), and time zone
Universal time: Display system time in the UTC zone.
RTC time: Display hardware time.
Time zone: Display the name of the time zone used by the system clock.
System clock synchronized: Display whether the system clock is synchronized with the remote NTP server.
systemd-timesyncd.service active: Display whether the time synchronization service between the system clock and NTP server is enabled.
RTC in local TZ: Display whether the hardware clock is in the UTC zone.
Changing the date only
The following command changes the date.
$timedatectl set-time yyyy-mm-dd
For example, the following command sets the date to 7 April 2025.
$timedatectl set-time 2025-04-07

Changing the date and time
The following command changes the date and time together.
$timedatectl set-time 'yyyy-mm-dd hh:mm:ss'
For example, the following command sets the date to 7 April 2025 and the time to 11:20:15.
$timedatectl set-time '2025-04-07 11:20:15'

Using a network time
Public NTP servers provide an accurate and reliable date and time. Instead of manually setting the date and time, you can instruct Ubuntu to set the system and hardware clocks from a public NTP server automatically. For it, you have to turn on the systemd.timesyncd.service service.
If this service is enabled, Ubuntu connects to the nearby public NTP server and retrieves the current date and time from it. It syncs the system and hardware clocks with the received date and time. It repeats this process periodically.
The following command turns on this service.
$sudo timedatectl set-ntp on

To turn off this service again, use the following command.
$sudo timedatectl set-ntp off

Changing time zone
To change the time zone, you need the exact name of the new time zone. The following command lists the names of all time zones.
$timedatectl list-timezones
The above command displays a long list of time zones. You can use the grep command to filter and view specific time zones. For example, the following command filters and displays all time zones of America that start with the letter L.
$timedatectl list-timezones | grep -o "America/L.*"

The following command updates the default time zone.
$sudo timedatectl set-timezone "name of the new time zone"

The above command changes the time zone only for the system clock. It does not update the time zone for the hardware clock. Ubuntu recommends keeping the hardware clock in the UTC zone. However, if you want to change the time zone of the hardware clock, you can use the following command.
$sudo timedatectl set-local-rtc 1
The above command sets the hardware clock's time zone to the time zone of the system clock.

To set the time zone of the hardware clock back to UTC, use the following command.
$sudo timedatectl set-local-rtc 0

Conclusion
The timedatectl command allows us to view, change, and manage date and time. In this tutorial, I explained how to use this command to view the current date and time, change the current date to a given date and time, and update the default time zone.
Author Laxmi Goswami Updated on 2026-05-20