How to Change the Time on CentOS 7 and 8

How to Change the Time on CentOS 7 and 8

Keeping the correct system time is essential when managing a CentOS server. An incorrect clock can cause problems with SSL/TLS certificates, cron jobs, log timestamps, database synchronization, authentication, monitoring, backups, and applications that depend on accurate time.

Fortunately, CentOS provides timedatectl, a convenient command-line utility for checking and changing the system clock, time zone, and network time synchronization. The same basic approach works on both CentOS 7 and CentOS 8.

Important: CentOS Linux 7 reached end of life on June 30, 2024, while CentOS Linux 8 reached end of life on December 31, 2021. Existing systems may still require administration, but production servers should be migrated to a supported operating system.

Check the Current Time on CentOS

Before changing anything, check the current date, time, time zone, and NTP synchronization status.

Run:

timedatectl

You should see information similar to:

Local time: Wed 2026-08-12 10:30:20 IST
Universal time: Wed 2026-08-12 05:00:20 UTC
RTC time: Wed 2026-08-12 05:00:20
Time zone: Asia/Kolkata (IST, +0530)
NTP enabled: yes
NTP synchronized: yes

The timedatectl command displays the local and UTC time, configured time zone, hardware clock information, and synchronization status. Red Hat’s system administration documentation also recommends it as the standard way to inspect and manage the system clock on RHEL 7-class systems.

If you only need to see the date and time, you can also use:

date

For a more detailed view, timedatectl is generally more useful.

Change the Time Zone on CentOS 7 or 8

A common reason for an apparently incorrect server time is that the system has the wrong time zone configured.

First, list available time zones:

timedatectl list-timezones

You can filter the results. For example:

timedatectl list-timezones | grep Asia

If your server should use Indian Standard Time, set the time zone to:

sudo timedatectl set-timezone Asia/Kolkata

For a server located in another region, replace Asia/Kolkata with the appropriate IANA time-zone name.

For example:

sudo timedatectl set-timezone America/New_York

or:

sudo timedatectl set-timezone Europe/London

After making the change, verify it:

timedatectl

Changing the time zone is different from manually changing the system clock. The time zone determines how the system represents local time relative to UTC, including daylight-saving rules where applicable. Red Hat documents timedatectl set-timezone as the standard method for changing the configured time zone.

How to Manually Change the Time

If the actual system clock is incorrect and you need to set it manually, use:

sudo timedatectl set-time HH:MM:SS

For example, to set the time to 11:30:00 PM:

sudo timedatectl set-time 23:30:00

Then verify the result:

timedatectl

You can also run:

date

Red Hat documentation notes that timedatectl set-time changes the system time and hardware clock. However, manually changing the time may fail when network time synchronization is enabled.

Change the Date on CentOS

You may also need to correct the server’s date.

The command is:

sudo timedatectl set-time '2026-08-12 23:30:00'

Replace the example date and time with the values you actually need.

Afterward, check:

timedatectl

and:

date

It is a good practice to verify the result immediately, especially on production servers where an incorrect date can affect scheduled jobs and application logs.

Enable Automatic Time Synchronization

For most servers, manually changing the clock should not be your normal long-term solution. Network Time Protocol (NTP) synchronization is preferable because the server can automatically keep its clock accurate.

Check the current synchronization status:

timedatectl

If NTP is disabled, you can enable it with:

sudo timedatectl set-ntp yes

Then check:

timedatectl

Look for:

NTP enabled: yes
NTP synchronized: yes

CentOS/RHEL systems commonly use chronyd for time synchronization. timedatectl can control whether network time synchronization is enabled, while the actual synchronization service depends on the installed NTP implementation.

You can check the Chrony service with:

sudo systemctl status chronyd

If necessary, start it with:

sudo systemctl start chronyd

And enable it to start automatically after reboot:

sudo systemctl enable chronyd

To check synchronization details with Chrony, use:

chronyc tracking

You can also view the configured time sources:

chronyc sources

These commands are especially useful when timedatectl reports that NTP is enabled but the server is not actually synchronized.

What If timedatectl set-time Does Not Work?

One of the most common problems is attempting to manually change the time while NTP synchronization is active.

Check:

timedatectl

If automatic synchronization is enabled, temporarily disable it:

sudo timedatectl set-ntp no

Then set the time:

sudo timedatectl set-time '2026-08-12 23:30:00'

After correcting the clock, re-enable automatic synchronization:

sudo timedatectl set-ntp yes

Finally, verify:

timedatectl

If the server immediately changes back to another time, an active NTP service may be correcting the clock. In that situation, investigate Chrony rather than repeatedly setting the clock manually.

Verify the Hardware Clock

Linux servers also have a hardware real-time clock (RTC). You can inspect it with:

sudo hwclock --show

You can compare the result with:

timedatectl

On Linux servers, keeping the RTC in UTC is generally preferred because it avoids ambiguity when systems or applications operate across different time zones.

Avoid changing RTC settings unless you understand how your operating system, virtualization platform, and applications use the hardware clock.

Common CentOS Time Problems

If your server time keeps becoming incorrect, check these areas:

  1. Incorrect time zone: Confirm the result of timedatectl.
  2. NTP disabled: Check whether network synchronization is enabled.
  3. Chrony not running: Run systemctl status chronyd.
  4. Network restrictions: NTP synchronization can be affected by firewall or network policies.
  5. Virtual machines: Hypervisors can influence guest clock behavior.
  6. Incorrect RTC configuration: Check hwclock and the RTC setting.
  7. Unsupported operating system: CentOS Linux 7 and 8 are both past their official end-of-life dates, so migration should be part of your server maintenance plan.

Quick Commands to Change Time on CentOS

Here is a practical reference:

# Check current time and configuration
timedatectl

# Show current date/time
date

# List available time zones
timedatectl list-timezones

# Set time zone
sudo timedatectl set-timezone Asia/Kolkata

# Disable NTP temporarily
sudo timedatectl set-ntp no

# Set the time
sudo timedatectl set-time 23:30:00

# Set date and time
sudo timedatectl set-time '2026-08-12 23:30:00'

# Re-enable NTP
sudo timedatectl set-ntp yes

# Check Chrony
sudo systemctl status chronyd

# Check synchronization
chronyc tracking

# Check hardware clock
sudo hwclock --show

Final Thoughts

Changing the time on CentOS 7 or CentOS 8 is straightforward when you use timedatectl. For a one-time correction, you can set the time manually. For a reliable production server, however, the better approach is to configure the correct time zone and use automatic synchronization through NTP/Chrony.

Accurate server time is particularly important for websites, APIs, databases, email infrastructure, security logs, scheduled tasks, and authentication systems. If your server is also used for mail delivery, accurate timestamps can be an important part of troubleshooting mail and SMTP issues. For related server administration, you may also find this guide useful: tips for choosing the best server for website hosting.

Finally, remember that changing the clock does not address the larger security issue of running an unsupported CentOS release. Since CentOS Linux 7 and 8 have reached EOL, plan migration to a currently supported operating system as part of your server maintenance strategy.

SHARE NOW!

About Me: Varun Rastogi

I’m Varun Rastogi, Founder & CEO of Getsvision Solutions Pvt Ltd, with 12+ years of experience in email marketing, SMTP infrastructure, digital marketing, SEO, and email deliverability. I hold certifications in HubSpot Email Marketing, Ahrefs Marketing Platform, Semrush for Agencies, and Canva Essentials.

Through my work and articles, I share practical insights on email campaigns, SMTP, SEO, digital marketing, and online business growth, helping businesses improve communication, visibility, engagement, and marketing performance.

top

Get your free Quote