Skip to main content
+44 7575 472931[email protected]
HostaccentKnowledge BaseHosting, websites, SEO, and growth

How to Set Timezone in Linux and Fix Wrong Timestamps (2026)

How to set timezone in Linux: run timedatectl set-timezone, keep NTP in sync, then fix the wrong timestamps it leaves in cron jobs, logs, PHP and MariaDB.

VPSBeginner Guide
How to set timezone in Linux with timedatectl, NTP sync status and corrected cron and log timestamps on an Ubuntu server

A backup scheduled for 2 a.m. fires at 8 a.m. Your logs claim an error happened 6 hours before anyone touched the server. Usually the culprit is a server still running on the timezone it shipped with. This guide shows how to set timezone in Linux properly, then fixes the stale timestamps a change leaves behind.

Quick Answer: To change the timezone on a Linux server, find your zone with timedatectl list-timezones, apply it with sudo timedatectl set-timezone Region/City, then confirm with timedatectl. Keep NTP service: active so the clock stays accurate, and restart cron, rsyslog and MariaDB afterwards. Those daemons read the zone only at startup, which is why timestamps stay wrong after a change. As of October 2026, this works on any systemd-based distro.

Last verified: October 2026. Ubuntu 24.04 LTS (systemd-timesyncd), Ubuntu 26.04 LTS (chrony with NTS by default), PHP 8.x date.timezone, MariaDB time_zone.

Hostaccent's support team resolves 20 to 30 client server issues every day, and a steady share of "my cron is broken" tickets turn out to be clock problems. What follows is the checklist our engineers actually run, written so you can do it yourself in about 10 minutes.

Check Your Current Timezone and Clock First

Run timedatectl with no arguments before you change anything. It shows local time, UTC, the hardware clock, the active zone and the sync status on one screen. A freshly built cloud server usually looks like this:

bash
$ timedatectl
               Local time: Fri 2026-10-30 09:25:10 UTC
           Universal time: Fri 2026-10-30 09:25:10 UTC
                 RTC time: Fri 2026-10-30 09:25:10
                Time zone: Etc/UTC (UTC, +0000)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

Three lines matter. Time zone is what you're about to change. System clock synchronized tells you whether the time itself is right. RTC in local TZ should read no on a server, which means the hardware clock stores UTC.

Those are two separate problems, and mixing them up wastes hours.

On a systemd-based Linux server, the timezone only changes how time is displayed, while clock synchronization decides whether the time is correct at all. systemd marks the clock as synchronized once the kernel's estimated error falls below 16 seconds, so a "no" on that line lasting more than a few minutes signals real drift, not a display setting.

For scripts, timedatectl show --property=Timezone --value prints just the zone name.

How to Set Timezone in Linux with timedatectl set-timezone

Find the exact zone name, apply it with one command, then verify. The change is instant and needs no reboot.

Step 1: Find your zone. Linux uses Region/City names from the IANA time zone database, not abbreviations like EST. Filter the full list with grep:

bash
timedatectl list-timezones | grep -i york
America/New_York

Step 2: Apply it.

bash
sudo timedatectl set-timezone America/New_York

Step 3: Verify. Run timedatectl again and look for Time zone: America/New_York (EDT, -0400). The command simply repoints the /etc/localtime symlink, which ls -l /etc/localtime confirms. The timedatectl manual page lists every other option.

Running sudo timedatectl set-timezone America/New_York takes effect immediately for every new process and leaves the actual clock untouched, because Linux keeps time in UTC internally and the zone only controls how that time is presented. As of October 2026, the same command works on Ubuntu, Debian, AlmaLinux, Rocky Linux and Fedora.

Minimal images and some containers don't run systemd, so set the link yourself:

bash
sudo ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
echo "America/New_York" | sudo tee /etc/timezone   # Debian/Ubuntu only

Debian and Ubuntu also offer sudo dpkg-reconfigure tzdata as an interactive menu. Docker containers don't inherit the host's zone at all: pass TZ=America/New_York as an environment variable and make sure the image includes tzdata, which Alpine leaves out. If you're running containers, start with our guide to installing Docker on an Ubuntu VPS for production.

Should my server run on UTC or local time?

UTC, for almost every server. It has no daylight saving jumps, so a 01:30 job can't run twice or vanish when the clocks change, and logs from servers in different regions line up without arithmetic. Choose local time only if people read raw timestamps all day and all of them share one zone.

Pro Tip: Keep the server on UTC and give individual jobs their own zone. A systemd timer accepts one directly, for example OnCalendar=*-*-* 09:00 America/New_York, and cronie on RHEL-family systems reads a CRON_TZ= line in the crontab. Debian's cron behaves differently, so check man 5 crontab before relying on it.

Professional help available

Still working through this server issue?

Send the symptoms, error output, and what you have already tried. We can work with Hostaccent services or infrastructure hosted with another provider.

Request server helpHow server support worksHosted elsewhere? One-time paid support is available after scope and price confirmation.

How NTP Sync Time on Linux Keeps the Clock Correct

The timezone decides how time is shown. NTP decides whether it's right. Enable it with sudo timedatectl set-ntp true, then confirm both NTP service: active and System clock synchronized: yes.

The daemon doing that work changed recently on Ubuntu, so check which one you have:

Distro (as of October 2026)Default time-sync daemonStatus command
Ubuntu 24.04 LTSsystemd-timesyncdtimedatectl timesync-status
Ubuntu 25.10 and 26.04 LTS (new installs)chrony, with NTS enabledchronyc tracking
AlmaLinux, Rocky Linux, RHELchronydchronyc sources -v

Ubuntu's own time synchronisation documentation confirms that machines upgraded from older releases may still be running systemd-timesyncd, so check rather than assume.

Clock accuracy matters more than the timezone on a production server. When the clock runs behind, browsers and APIs reject TLS certificates as not yet valid, apt fails with a "Release file is not valid yet" error, and two-factor TOTP codes, which rotate every 30 seconds, start failing once drift passes roughly 30 to 60 seconds.

If you searched "change server time ubuntu" because the clock itself is wrong rather than the zone, don't reach for date -s. With NTP enabled, timedatectl set-time refuses to run, and a manual time gets overwritten at the next sync anyway. Fix the sync instead: run only one time daemon, allow outbound UDP port 123 in UFW or CSF (chrony's NTS also needs TCP port 4460), and read the real error with journalctl -u chrony or journalctl -u systemd-timesyncd.

Insider Insight: We run our own KVM/Proxmox virtualization, and a pattern our team has seen many times is a VPS restored from a live snapshot (one that saved RAM state) waking up with the snapshot's clock, hours or days behind. A sync daemon can take a long while to slew that back, so force the jump with sudo chronyc makestep (or restart systemd-timesyncd) before cron runs anything.

Fix Wrong Time in Logs and Cron After a Timezone Change

Long-running daemons read the timezone once, at startup. Change the zone and they keep scheduling and stamping in the old one until you restart them.

bash
# Debian / Ubuntu
sudo systemctl restart cron rsyslog

# AlmaLinux / Rocky / RHEL
sudo systemctl restart crond rsyslog

# Database and app processes (adjust to your stack)
sudo systemctl restart mariadb
pm2 restart all --update-env

To prove it worked, add * * * * * date >> /tmp/tz-test.log to your crontab, wait 2 minutes, check the zone in the output, then remove the line.

Not every component follows the system zone, though:

ComponentWhere it gets its timezoneWhat to do after a change
cron / crondSystem zone, read at daemon startRestart the cron service
rsyslog (/var/log/syslog)System zone, read at startRestart rsyslog
systemd journalStores UTC, displays in the current zoneNothing; use journalctl --utc to compare
PHP (FPM and CLI)date.timezone in php.ini, default UTCSet it, then restart PHP-FPM
MariaDBtime_zone (default SYSTEM), fixed at startupRestart, or set default_time_zone
Node.js under PM2TZ variable, else system zone at startpm2 restart all --update-env
Docker containersTheir own TZ and /etc/localtimeSet TZ, include tzdata

The PHP row catches people out. According to the PHP date configuration reference, PHP uses date.timezone and falls back to UTC, never the server's zone. On Ubuntu, PHP-FPM and the CLI also read separate php.ini files, so a cron script can disagree with your website. WordPress forces PHP to UTC internally and applies its own zone from Settings, General, so change it there. On the database side, MariaDB's time zone documentation explains why system_time_zone only refreshes on restart.

After a timezone change on Linux, cron, rsyslog and MariaDB keep the old zone until restarted, because each reads it once at startup, while PHP ignores the system zone and defaults to UTC. As of October 2026, restarting those three services and checking PHP's date.timezone fixes wrong timestamps in under 5 minutes on a typical web server.

If cron isn't firing at all, that's a different fault; work through fixing a cron job that isn't running on Linux. Re-check any automated rsync backups on cron too, since a backup that drifts into peak hours competes with live traffic for disk I/O. For PM2-managed apps, the --update-env flag matters; our Node.js deployment guide with PM2 and Nginx covers the wider setup.

The 3-Clock Check

Across the 4,000+ sites Hostaccent has migrated since 2016, clock mismatches are among the quietest post-move problems: nothing errors, the data is simply hours off. Every timestamp a site writes comes from one of three clocks (the operating system, the application runtime and the database session), so our engineers compare all three in under a minute:

bash
date +"%Z %z"
php -r 'echo date_default_timezone_get(), PHP_EOL;'
mariadb -e "SELECT @@global.time_zone, @@system_time_zone, NOW(), UTC_TIMESTAMP();"

Pass means all three agree, or all three report UTC and the application converts for display. The PHP line tests the CLI only; for the website itself, check a phpinfo() page.

Common Mistakes That Bring Wrong Timestamps Back

Most repeat problems trace back to four habits, each with a one-line fix.

Using abbreviations. "IST" can mean India, Ireland or Israel, and "EST" ignores daylight saving entirely. Always use Region/City, such as Asia/Kolkata.

The Etc/GMT sign trap. Etc/GMT+5 is 5 hours behind UTC, because the POSIX convention flips the sign. In our experience, this one burns people precisely because they're trying to be exact. A city zone avoids it.

Stale tzdata. Governments change daylight saving rules, sometimes with only weeks of notice. Routine apt upgrade or dnf upgrade runs keep the tzdata package current; restart long-running services afterwards so they load the new rules.

A hardware clock on local time. If timedatectl shows RTC in local TZ: yes on a server, run sudo timedatectl set-local-rtc 0. A local-time RTC only makes sense on a desktop that dual-boots Windows.

The most reliable way to prevent wrong timestamps on a Linux server is to set UTC and enable NTP during initial provisioning, then convert to local time in the application. A server configured this way never meets the two daylight saving transitions each year, and as of 2026 it remains standard practice for production fleets. It's one of the first steps in our 30-minute Ubuntu 24.04 security baseline.

Pro Tip: Add clock offset to your monitoring alongside CPU and disk. A check that alerts when chronyc tracking reports more than 1 second of offset catches a stalled sync days before certificates or 2FA start failing. Our guide to setting up server monitoring on a VPS is a good place to wire it in.

Your Next Step: A Server Where the Clock Is Already Right

  • Learning how to set timezone in Linux comes down to one command: sudo timedatectl set-timezone Region/City.
  • Keep production servers on UTC and give human-facing jobs their own zone.
  • Treat accuracy separately: you want NTP service: active and System clock synchronized: yes.
  • After any change, restart cron, rsyslog and MariaDB, and check PHP's date.timezone on its own.

Now that you know cron and MariaDB hold on to the old zone until they restart, you can either audit every service on your current box or start fresh on a server you control from the first login. You get full root access, NVMe storage and free 30 Gbps DDoS protection, backed by 24/7 support from Hostaccent's in-house engineers and a 30-day money-back guarantee. The Standard plan at $12.00/mo renews at $12.00/mo, so the price you start on is the price you keep. One honest caveat: no cPanel or Plesk licence is included, so budget for one if you want a panel. Start on the Standard VPS plan and set your timezone in your first five minutes.

Frequently Asked Questions

Do I need to reboot after changing the timezone?

No. The system switches immediately, and every new process sees the new zone. The catch is long-running daemons that read the zone at startup: cron, rsyslog, MariaDB and your application processes keep the old one until restarted. Restarting those services is enough, and it takes seconds rather than the minute or two of downtime a reboot costs. If you can't map every service, a reboot during a quiet window is the blunt but reliable option.

How to set timezone in Linux without timedatectl?

Point the /etc/localtime symlink at the right zoneinfo file with sudo ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime. On Debian and Ubuntu, also write the name to /etc/timezone, or run sudo dpkg-reconfigure tzdata for an interactive menu. Inside Docker containers, set the TZ environment variable instead and make sure the tzdata package is installed, because slim images such as Alpine ship without it. Restart long-running services afterwards, exactly as you would with timedatectl.

Why is my cron job running at the wrong time?

Usually because cron reads schedules in the server's zone, and that zone isn't the one you had in mind. Cloud servers typically ship on UTC, so a job written for 9 a.m. New York time fires at 5 a.m. New York time during daylight saving. Either convert the schedule to UTC, change the system zone and restart cron, or give the job its own zone with a systemd timer. Run grep CRON /var/log/syslog to see when it actually fired.

Does changing the server timezone change PHP or WordPress time?

Not by itself. PHP ignores the system zone and uses date.timezone from php.ini, which defaults to UTC, and PHP-FPM and the CLI often read different php.ini files. WordPress goes further: it forces PHP to UTC internally and applies the zone you pick under Settings, General. So for WordPress, change that setting rather than the server. For custom PHP apps, set date.timezone in the FPM php.ini and restart PHP-FPM.

Why does timedatectl say System clock synchronized: no?

It means the kernel's estimated clock error hasn't dropped below the 16-second threshold systemd uses, so the time can't be trusted yet. Right after boot that's normal for a minute or two. If it persists, check that only one time daemon runs (chrony, ntpd or systemd-timesyncd, never two), that outbound UDP port 123 is open in your firewall, and read journalctl -u chrony or journalctl -u systemd-timesyncd for the actual error.

Professional help available

Still not resolved? Let a server specialist take it from here.

Send the symptoms, error output, and what you have already tried. We can work with Hostaccent services or infrastructure hosted with another provider.

  • No hosting transfer required
  • Scope confirmed before paid work
  • No changes before your approval
Request server helpHow server support worksHosted elsewhere? One-time paid support is available after scope and price confirmation.
Reviewed by

Hostaccent Editorial Team

Reviewed for technical accuracy and clarity before publication.

Last updated

Nov 9, 2026

HostAccent Editorial Team publishes practical hosting guides, operations checklists, and SEO-focused tutorials for businesses building international web presence.

Discussion

Have a question or tip about this topic? Share it below — your comment will appear after review.

Your email stays private and is only used for moderation.

Write for the Community

Have a tutorial, tip, or insight to share? Get published on the Hostaccent Blog with your name, bio, and website link.

Become a Contributor

Need a faster setup for this workflow?