Timedatectl command to set the date – time and time zone of the system on Linux

Linux Tutorials

June 2, 2020 by Harry

Timedatectl command to set the date – time and time zone of the system on Linux

The timedatectl command is one of the new tools for RHEL / CentOS 7 and Fedora 21+ distributions, which is part of the systemd and service manager system and we will use ut to set the date – time. And it is actually a replacement for the old and traditional date command used in the sysvinit service in Linux distributions.

The timedatectl command allows you to change the system clock configurations as well as its settings. You can use this date command on your system to define or change time and timezone as well as enabling automatic system clock, which is actually synchronized with NTP Server Remote.

In this article, we’re going to show you how to manage time on your Linux systems by setting the date, time, timezone, and syncing time using NTP, and using the new timedatectl command through the terminal.

What are the benefits of having the correct time zone on the server?

  • Existence of time-based performance of system tasks (since most tasks in Linux are controlled by time)
  • Set the date – time to create login event and other information on the system and …

Time-zone in Linux

How to find and define Local Timezone on Linux

To display the time and date on your system, run the timedatectl command as follows.

# timedatectl  status

See time using timedatectl on Linux

In the image above, RTC time is actually the hardware’s clock time.

Time on your Linux systems is always managed through the timezone defined on the system. To display timezone now, run the following command on your system.

# timedatectl
# timedatectl | grep Time

see time using timedatectl

Run the following command to display all available timezones.

# timedatectl list-timezones

List all timezones in Linux

To find local timezone, run the following command according to your location.

# timedatectl list-timezones |  egrep  -o Asia/B.*
# timedatectl list-timezones |  egrep  -o Europe/L.*
# timedatectl list-timezones |  egrep  -o America/N.*

Display time-zone according to your location

To define your local timezone in Linux, we will use the set-timezone option as follows.

# timedatectl set-timezone Asia/Kolkata
# timedatectl

Set time-zone on Linux

It is always recommended to use and define coordinated universal time, UTC.

# timedatectl set-timezone UTC

Set time to UTC

Note: You must enter the correct timezone name, otherwise you will receive an error. For example, the timezone “Asia / Kalkata” is not correct, so it gives an error.

How to set the date – time on Linux

You can use the timedatectl command to set the date – time on your system.

To set only time, the set-time option is used along with the time format, which is mostly HH: MM: SS (Hour, Minute, and Seconds).

# timedatectl set-time 15:58:30

Seti time in Linux

You may face the below error when running this command:

Failed to set time: NTP unit is active

It says that NTP service is active. You can deactivate it using the below command.

# systemctl disable --now chronyd

To set the date only, the set-time option along with the date format in the form of YY: MM: DD (Year, Month, Day) is used.

# timedatectl set-time 2019-04-05

Set Date lin Linux

To set the date – time, do the following.

# timedatectl set-time '16:10:40 2015-11-20'

Set date-time with each other

How to find and define Hardware Clock on Linux

The set-local-rtc boolean-value option is used to set the Hardware Clock to UTC or coordinated universal time.
First, use the following command to find out if our hardware clock is defined as a local timezone.

# timedatectl | grep local

Define your hardware clock to local timezone.

# timedatectl set-local-rtc 1

Find the hardware clock format

Set your hardware clock to coordinated universal time (UTC).

# timedatectl set-local-rtc 0
# timedatectl | grep local

Set UTC in Linux

Sync Linux system clock using a remote NTP server

NTP stands for Network Time Protocol and is actually an Internet protocol used to sync system clocks between computers. The timedatectl tool allows you to automatically sync your Linux system clock using a group of remote NTP servers.

Please note that you must install NTP on the system to enable automatic sync time with NTP servers.
To start automatic synchronization time with the NTP remote server, enter the following command in the terminal.

# timedatectl set-ntp- true

Enable synchronization with NTP server in Linux

To disable NTP time synchronization, run the following command in the terminal.

# timedatectl set-ntp- false

Disable synchronization with NTP server in Linux


In this article, we have explained very easy examples and we hope that it will be useful for you and that you can set the date – time and timezone of different Linux systems. To learn more about this tool, visit the timedatectl man page.


About the Author Harry

I like to learn and to teach to make things easier

Leave a Reply

Your email address will not be published. Required fields are marked *