Skip to main content

timedatectl

timedatectl is the standard Linux command to check and manage server time, timezone, and NTP synchronization.

Why this matters in server onboarding

Correct time is required for:

  • SSL/TLS certificate validation
  • cron jobs and scheduled tasks
  • log analysis and incident timelines
  • database replication and backup consistency

If server time is wrong, many systems fail in confusing ways.

Quick status checks

Show current time status

timedatectl status

Show machine-readable output

timedatectl show

Look for:

  • Time zone
  • System clock synchronized
  • NTP service

Set timezone correctly

List available timezones

timedatectl list-timezones

Set timezone (example: Jakarta)

sudo timedatectl set-timezone Asia/Jakarta

Verify

timedatectl status

Enable NTP synchronization

Enable NTP

sudo timedatectl set-ntp true

Disable NTP

sudo timedatectl set-ntp false

Verify sync state

timedatectl status

Expected healthy state:

  • NTP service: active
  • System clock synchronized: yes

Set time manually (only when needed)

Manual time setting should be temporary and used only for recovery or isolated systems.

sudo timedatectl set-time "2026-02-15 22:30:00"

After manual correction, re-enable NTP:

sudo timedatectl set-ntp true

RTC mode (hardware clock)

Use UTC for servers (recommended):

sudo timedatectl set-local-rtc 0

Use local time (generally not recommended on servers):

sudo timedatectl set-local-rtc 1

Troubleshooting checklist

  1. Confirm timezone is correct.
  2. Confirm NTP is enabled.
  3. Confirm System clock synchronized: yes.
  4. Check UDP/123 reachability if sync fails.
  5. Check which time service is running (systemd-timesyncd, chronyd, or ntpd).

Useful companion commands

date
timedatectl status
journalctl -u systemd-timesyncd --no-pager -n 50
  • Set timezone to your operational region.
  • Enable NTP immediately after first login.
  • Keep RTC in UTC (set-local-rtc 0).
  • Verify time settings before installing SSL, database, and backup jobs.