ThisCalculator

Everyday

Change Time in Ubuntu: Complete System Clock Guide

Updated · Standard formula, shown below

Change Time in Ubuntu: Complete System Clock Guide

This guide explains how to change the time in Ubuntu, covering both the graphical settings and the command-line tools like timedatectl, and how to manage the system clock, time zone, and NTP synchronization. You will learn the difference between the hardware clock (RTC) and the system clock, how to set each one correctly, and how to fix common time-related issues.

Understanding Ubuntu’s Two Clocks

Every Ubuntu system has two clocks that work together:

  • Hardware Clock (RTC): Also called the CMOS clock or BIOS clock, this runs even when the computer is off, powered by a small battery on the motherboard.
  • System Clock: A software clock maintained by the Linux kernel while the system is running. It starts from the hardware clock at boot and then tracks time precisely.

The system clock is what applications and the date command see. The hardware clock is only read at boot and written back during shutdown. This separation is why changing the time in Ubuntu can involve two different steps depending on whether you want a permanent or temporary change.

Viewing Current Time and Time Zone

Before changing anything, check the current state. Open a terminal (Ctrl+Alt+T) and run:

timedatectl

This shows the local time, universal time (UTC), the time zone, whether NTP is active, and whether the RTC is set to local time or UTC. A typical output looks like:

               Local time: Mon 2025-05-12 14:32:05 EDT
           Universal time: Mon 2025-05-12 18:32:05 UTC
                 RTC time: Mon 2025-05-12 18:32:05
                Time zone: America/New_York (EDT, -0400)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

If NTP is active, the system automatically adjusts the time over the network, so manual changes will be overwritten. For a manual change, you must first disable NTP.

Changing the Time Zone

The most common time-related task is setting the correct time zone. This does not change the actual moment in time, only how it is displayed locally.

Graphical method (GNOME):

  1. Open Settings from the system menu.
  2. Go to Date & Time.
  3. Turn off Automatic Time Zone if it is on.
  4. Click the time zone field and type your city or select it on the map.

Command line:

sudo timedatectl set-timezone America/Chicago

To list all available zones:

timedatectl list-timezones

Use the exact format Region/City (e.g., Europe/London, Asia/Kolkata). This change is permanent and survives reboots.

Setting the Time Manually (Temporary)

If you need to set the time by hand, first disable NTP so your change is not reverted:

sudo timedatectl set-ntp false

Then set the date and time:

sudo timedatectl set-time "2025-05-12 14:30:00"

Or use the date command:

sudo date -s "2025-05-12 14:30:00"

This changes the system clock immediately. However, because the hardware clock is only synced at shutdown, a reboot may revert the change unless you also update the RTC. To write the current system time to the hardware clock, run:

sudo hwclock --systohc

To re-enable automatic time after manual changes:

sudo timedatectl set-ntp true

Configuring the Hardware Clock (RTC)

Ubuntu by default treats the hardware clock as UTC and converts to local time for display. This is the recommended setting for systems that also run Windows, which expects the RTC to be local time. If you dual-boot, you will see a time offset of several hours between the two operating systems.

To check the current RTC setting:

timedatectl | grep "RTC in local TZ"

To set the RTC to local time (not recommended for Linux-only systems):

sudo timedatectl set-local-rtc 1

To revert to UTC:

sudo timedatectl set-local-rtc 0

If you change this setting, reboot so the system re-reads the RTC correctly. Dual-boot users often prefer set-local-rtc 1 to avoid the Windows/Linux time conflict, but this can cause issues with NTP and daylight saving time handling.

Fixing Common Time Problems

Time drifts or is wrong after reboot: The CMOS battery may be dead. Replace it. You can test by setting the time, rebooting, and checking if it resets.

Dual-boot time offset: Windows stores local time in the RTC, while Ubuntu stores UTC by default. The fix is either to make Windows use UTC (via a registry edit) or to make Ubuntu use local time as described above.

NTP not working: Check if the systemd-timesyncd service is running:

systemctl status systemd-timesyncd

If it is inactive, start it:

sudo systemctl enable --now systemd-timesyncd

You can also check the NTP servers in /etc/systemd/timesyncd.conf and add your own, such as pool.ntp.org.

Time is correct in terminal but wrong in the desktop clock: This usually means the time zone is wrong. Recheck with timedatectl and set the correct zone.

Using NTP for Automatic Synchronization

Network Time Protocol (NTP) keeps your clock accurate by syncing with remote time servers. Ubuntu uses systemd-timesyncd by default, which is lightweight and sufficient for most users.

To enable NTP:

sudo timedatectl set-ntp true

To check the sync status:

timedatectl status

For more advanced needs (e.g., running a server), you can install the full ntp package or chrony, but for a desktop, the built-in service is enough. NTP uses UDP port 123, so a firewall must allow outbound traffic on that port.

Frequently Asked Questions

Why is my Ubuntu time off by exactly 5 hours after dual-booting with Windows? This is the classic UTC vs. local time conflict. Windows assumes the RTC is local time, while Ubuntu assumes UTC. Set Ubuntu to use local time with sudo timedatectl set-local-rtc 1, or better, configure Windows to use UTC.

How do I change the time without sudo? You cannot. Changing the system time is a privileged operation that affects all users, so it requires root access. You can, however, change your personal time zone in the graphical settings without sudo.

What is the difference between date and hwclock? date shows and sets the system clock (software). hwclock shows and sets the hardware clock (RTC). They can be synced with hwclock --systohc (system to hardware) or hwclock --hctosys (hardware to system).

Will changing the time break my scheduled tasks (cron)? Yes, if you change the time while cron jobs are running or due, they may be skipped or run twice. It is best to change time when the system is idle, and remember that cron uses the system time zone.

How do I set the time zone for a single user only? You can set the TZ environment variable in your .bashrc or .profile file, e.g., export TZ="America/Los_Angeles". This overrides the system time zone for that user’s shell sessions.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.