Keeping the correct date and time on your Linux system is crucial for logging, security, and network synchronization. Whether you need to manually adjust the time, synchronize with an online server, or configure time zone settings, Linux offers multiple ways to do so. This guide will walk you through different methods for setting the date and time on Linux, ensuring accuracy and proper system functionality.

Need the commands right now? On any modern systemd-based distribution, timedatectl is the tool you'll reach for. Substitute your own date, time, and IANA timezone in the examples below.

Quick Answer card with four timedatectl steps for checking status, disabling NTP, setting time and timezone.

🔍 Quick Answer: Check Current Date and Time

timedatectl status
date

⚙️ How to Manually Set Date and Time

sudo timedatectl set-ntp false
sudo timedatectl set-time "2026-07-16 14:45:00"

🌍 Change the Timezone

sudo timedatectl set-timezone America/New_York
timedatectl status

🔄 Enable Automatic Time Synchronization

sudo timedatectl set-ntp true
timedatectl timesync-status

That's the whole job for most people. If you want to understand why each step matters — and how to fix things when they break — keep reading.

⚠️ Before You Change the Linux System Clock

A couple of quick warnings before you start typing. Getting these wrong is how people end up with a clock that keeps snapping back to the wrong value.

Check whether NTP is enabled

If automatic synchronization is on, Linux will politely refuse to let you set the time by hand. You'll see "Failed to set time: Automatic time synchronization is enabled." So check first:

timedatectl status
sudo timedatectl set-ntp false

Don't leave synchronization off permanently unless you have a specific reason. Most machines want NTP running.

Use sudo or a root account

Reading the clock needs no special rights. Changing it does. Every command that modifies the time or timezone needs sudo or a root shell. If you're new to the terminal, our guides to essential Linux commands and how to use Linux are good primers.

Back up config files before editing them

When you get to custom NTP servers later, you'll edit files like /etc/chrony.conf. Copy them first. One cp file file.bak saves a lot of grief.

🕐 How Linux Manages Date and Time

Two clocks, not one. That trips up beginners constantly. If you're still getting familiar with the operating system itself, here's what is Linux — a quick overview that helps contextualize these concepts.

Diagram showing RTC read at boot, Linux system clock, and NTP correcting drift over UDP port 123.

System clock vs hardware clock

Linux has two types of clocks. The system clock (software clock) is maintained by the Linux kernel after the system boots up. The hardware clock — also called the RTC (real-time clock) — sits on the motherboard and keeps ticking even when the power is off, thanks to a small CMOS battery. At boot, Linux reads the RTC to set an initial time, then a synchronization service nudges the system clock to the correct value.

To check both clocks:

hwclock --show
date

UTC, local time, and timezones

UTC is the global reference. Your local time is UTC plus or minus your timezone offset, adjusted for daylight saving. Linux uses the IANA timezone database, so you'll specify zones like America/New_York or Asia/Kolkata — not vague abbreviations like "IST."

How NTP keeps the clock accurate

Quartz clocks drift. A few seconds a day adds up fast. The Network Time Protocol fixes this by polling accurate time servers over UDP port 123 and gently correcting the system clock — no manual babysitting required.

📅 Set Date and Time with timedatectl

This is the recommended modern method. Follow the workflow in order and you won't hit the "synchronization enabled" wall.

Stylised timedatectl status panel showing local, UTC, RTC, timezone, and active NTP values.

Before making changes, check your system's current time:

Terminal showing timedatectl status command output with date and time details

timedatectl status

This will show:

Detailed timedatectl status output showing local time, UTC, RTC, timezone, and NTP status

Set the date and time

sudo timedatectl set-ntp false
sudo timedatectl set-time "2026-07-16 14:45:00"

That timestamp is interpreted in your configured local timezone. Set the zone first if it's wrong.

Verify the change

timedatectl status

Confirm the local time, timezone, and NTP status all read correctly before moving on.

📝 Set Date and Time with the date Command

The classic date command still works. It's lowercase — always.

Terminal showing date command with manual date setting syntax

Use a human-readable date string

sudo date --set="2026-07-16 14:45:00"

Clear, readable, hard to mess up. This is what I'd hand a beginner.

Use the compact numeric format

The old-school format looks cryptic but it's compact. The pattern is MMDDhhmm[[CC]YY][.ss]:

sudo date 071614452026

Display a custom date format

date +"%Y-%m-%d %H:%M:%S"

Handy for scripts and logs that expect ISO 8601. Other useful formats:

date +"%d-%b-%Y"
date +%s

Setting Date and Time Permanently

To ensure changes persist after reboot, update the hardware clock:

sudo hwclock --systohc

This syncs the system time to the hardware clock.

🌍 Change the Timezone in Linux

timedatectl list-timezones
timedatectl list-timezones | grep -i new_york
sudo timedatectl set-timezone America/New_York
timedatectl status

To run a server in UTC — which I'd recommend for almost any server:

sudo timedatectl set-timezone UTC

🔄 Synchronize the System and Hardware Clocks

Direction matters here. Copy the wrong way and you overwrite a correct clock with a bad one.

Diagram showing --systohc and --hctosys directions between the Linux system clock and hardware RTC.
# System clock -> hardware clock (store RTC in UTC)
sudo hwclock --systohc --utc

# Hardware clock -> system clock
sudo hwclock --hctosys

# Set hardware clock manually
sudo hwclock --set --date "2025-03-25 14:45:00"

Use --systohc when your system time is correct and you want the RTC to match. Use --hctosys for the reverse. For dual-boot machines with Windows, keeping the RTC in UTC on Linux avoids the classic "clock jumps hours" problem.

🌐 Synchronize Linux Time with an NTP Server

Don't install every time daemon you find. Running two at once causes conflicts. Identify what's active first, then stick with it.

How to Set Time and Date from Internet Time Servers using NTP

Service Best Use Typical Distributions Note
systemd-timesyncd Lightweight client sync Many systemd distros Client only; managed via timedatectl
Chrony Servers, VMs, laptops RHEL-family, modern distros Handles drift and jumps well
ntpd Legacy/specialized Older systems Mostly replaced by Chrony
ntpdate One-time legacy sync Older systems Deprecated on most current distros

Enable systemd-timesyncd

sudo timedatectl set-ntp true
timedatectl timesync-status

Configure and verify Chrony

To install Chrony:

# Ubuntu/Debian
sudo apt install chrony

# CentOS/Rocky Linux
sudo yum install chrony

Enable and start:

sudo systemctl enable --now chronyd

Check status and force sync:

chronyc tracking
chronyc sources -v
sudo chronyc makestep

Use traditional ntpd

sudo systemctl enable --now ntpd

Configure a custom NTP server

For Chrony, edit /etc/chrony.conf and add a server line, then restart. For timesyncd, edit /etc/systemd/timesyncd.conf and set the NTP= value.

🐧 Distribution-Specific Commands

Package names and service names aren't universal. Here's the tested breakdown.

Terminal showing time synchronization commands for Kali Linux

Distribution Install Package Service Name
Ubuntu / Debian timesyncd built-in; apt install chrony chrony / systemd-timesyncd
RHEL / Rocky / Alma / Oracle dnf install chrony chronyd
Fedora dnf install chrony chronyd
Arch Linux timesyncd built-in systemd-timesyncd
Kali Linux apt install chrony chrony

Specific Distribution Notes

Arch Linux: To enable automatic time synchronization: sudo systemctl enable systemd-timesyncd && sudo systemctl start systemd-timesyncd. To manually set the time: sudo date 032514452025. For heavier workloads, a Linux dedicated server gives you full control over time synchronization and every other system setting.

Rocky Linux: For manual setting: sudo timedatectl set-time "2025-03-25 14:45:00". For NTP: sudo systemctl enable --now chronyd. On a Rocky Linux VPS, Chrony is usually the default time service and works well out of the box.

Oracle Linux: Manual: sudo date --set="2025-03-25 14:45:00". Auto: sudo yum install ntp && sudo systemctl enable ntpd --now.

Kali Linux: Manual: sudo date 032514452025. Sync: sudo timedatectl set-ntp true. If you run your security lab on a Kali Linux VPS, keeping the clock accurate is essential for packet captures and forensic timestamps.

🖥️ Set Date and Time with GNOME or KDE

For users who prefer a graphical interface, most Linux desktop environments provide an easy way to adjust the date and time.

Stylised Date & Time panel with Automatic Date & Time enabled and its timedatectl command.

GNOME (Ubuntu, Fedora, Debian)

  1. Open Settings.
  2. Navigate to Date & Time.
  3. Toggle Automatic Date & Time if you want to use an internet time server. That toggle maps directly to timedatectl set-ntp true.
  4. To set the time manually, disable automatic sync and enter the desired date and time.

KDE Plasma (Kubuntu, OpenSUSE, Arch Linux)

  1. Open System Settings.
  2. Go to Regional Settings > Date & Time.
  3. Click Set Date and Time and enter the correct values.

For systems that do not allow GUI changes due to administrative restrictions, use the timedatectl command instead.

⚠️ Troubleshoot Incorrect Linux Date and Time

Decision tree for diagnosing Linux timezone, NTP, network, RTC, container, and VM clock problems.
Symptom Check Likely Fix
Manual change fails timedatectl status Disable NTP temporarily
NTP synchronized: no Service status, DNS, UDP 123 Restart service, check network
Clock resets after reboot hwclock --show Sync to RTC or replace CMOS battery
Right zone, wrong app time App/container settings Restart app or set container TZ
Chrony has no source chronyc sources -v Fix server, DNS, or firewall
Time jumps in a VM Hypervisor guest tools Stop competing sync sources

Additional Troubleshooting Steps

If your Linux system fails to update its time correctly:

  • Restart the NTP or Chrony Service: sudo systemctl restart chronyd or sudo systemctl restart ntpd.
  • Manually Force Time Sync: sudo ntpdate pool.ntp.org if automatic sync fails.
  • Verify System Logs for Errors: journalctl -xe | grep -i "time" or journalctl -u chronyd --since today.

📋 Linux Date and Time Command Cheat Sheet

Method Description Command Example Distribution
Manual Setting Set date and time manually sudo date MMDDhhmmYYYY All Linux Distros
NTP Sync with internet time servers sudo timedatectl set-ntp true Ubuntu, CentOS, Debian, etc.
Chrony Time synchronization using Chrony service sudo chronyc -a 'burst 4/4' RHEL, CentOS, Fedora

Quick Reference

Task Command Root?
Check status timedatectl status No
Set time timedatectl set-time "..." Yes
Set timezone timedatectl set-timezone Zone Yes
Enable NTP timedatectl set-ntp true Yes
Force sync chronyc makestep Yes
System to RTC hwclock --systohc Yes

🏁 Conclusion

Managing date and time in Linux is essential for maintaining system integrity, security, and performance. Keep it simple: use timedatectl for everyday date, time, and timezone changes. Let Chrony or your active sync service handle continuous accuracy. Reach for hwclock only when you genuinely need to manage the hardware clock. And never run two time daemons at once.

By following this guide, you can ensure that your Linux system's date and time settings remain correct and consistent, preventing issues with logs, authentication, and network communication. Running these commands on a server you fully control makes life easier if you need one, take a look at our Linux VPS hosting options.

People also read: