Configuring System Date and Time Settings
System time is based on the POSIX time standard, where time is measured as the number of seconds that have elapsed from 00:00:00 Coordinated Universal Time (UTC), Thursday, January 1, 1970. A day is defined as 86400 seconds and leap seconds are subtracted automatically.
Date and time representation on a system can be set to match a specific timezone. To list the available timezones, run:
timedatectl list-timezones
To set the system timezone to match a value returned from the available timezones, you can run:
timedatectl set-timezone America/Los_Angeles
Substitute America/Los_Angeles with a valid timezone entry.
This command sets a symbolic link from /etc/localtime
to point to the appropriate zone information file in /usr/share/zoneinfo/
. The setting takes effect immediately. Some long running processes that use /etc/localtime
to detect the current system timezone might not detect a change in system timezone until the process is restarted.
Note that timezones are largely used for display purposes or to handle user input. Changing timezone doesn't change the time for the system clock. You can change the presentation for system time in any console by setting the TZ
environment variable. For example, to see the current time in Tokyo, you can run:
TZ="Asia/Tokyo" date
You can check the system's current date and time configuration by running the timedatectl command on its own:
timedatectl
Local time: Wed 2021-07-17 00:50:58 EDT
Universal time: Wed 2021-07-17 04:50:58 UTC
RTC time: Wed 2021-07-17 04:50:55
Time zone: America/New_York (EDT, -0400)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
To set system time manually, use the timedatectl set-time command:
timedatectl set-time "2021-07-17 01:59:59"
This command sets the current system time based on the time specified assuming the currently set system timezone. The command also updates the system Real Time Clock (RTC).
Tip:
See for a hands-on tutorial that describes how to use tools to configure system parameters such as date, time, and locale.Consider configuring the system to use network time synchronization for more accurate time-keeping. Using network time synchronization is important especially when setting up high-availability or when using network-based file systems.
For more information about configuring the network time services that use NTP, see Oracle Linux 9: Setting Up Networking.
Tip:
See Configure Chrony on Oracle Linux for a hands-on tutorial on setting up and configuring thechronyd
service.
If you configure an NTP service, enable NTP by running the following command:
timedatectl set-ntp true
This command enables and starts the chronyd
service, if available.