Home Linux CentOS How to Set Date & Time in CentOS 7

How to Set Date & Time in CentOS 7

In our previous tutorial, we have learned about CentOS basic commands. Now we will learn how to set date & time in CentOS 7, you can using timedatelctl utility.

How to Check Current Date & Time on System

Use the command timedatectl to check the current date & time, you can also check local system time using date command and timedatectl displays lot of information like local time, UTC time, RTC time and time zone information.

timedatectl command output
timedatectl command output
  • As the output of timedatctl shows the Local time, UTC, RTC time., Time zone, NTP enabled, NTP synchronized, DST time. Here is the explanation for these terms:
  • Local Time: This will show the date, time and zone presently running on your system.
  • UTC: It displays the UTC (Coordinated Universal Time) time and date at that moment.
  • RTC Time: Real-time clock, is responsible to keep time accurately even when the system is powered off. It is basically an IC on the system, which is powered by the CMOS-Battery.
  • Time Zone: UTC is known as the world’s time standard.As you know that different regions have different time zones. You need to choose the time zone as per your region.
  • NTP Enabled & Synchronization: Network Time Protocol is the internet protocol used to synchronize the clock of the system with some reference time device connected over the network.
  • DST Time: Daylight Saving time used in some countries to save the energy by forwarding clock almost 1 hour in the summer weather and in cold, back clocks again to 1 hour.

How to Change Date & Time

Using timedatectl we can set date & time both with one command.

 [arun@localhost ~]$ timedatectl set-time '2018-12-25 13:17' 
Change time & date on CentOS 7
Change time & date on CentOS 7

How to Change Time Zone

  • First check the available time zones by issueing the command:
 [arun@localhost ~]$ timedatectl list-timezones 
  • Now choose the time zone as per your region.
 [arun@localhost ~]$ timedatectl set-timezone Asia/Kolkata  
Choose time zone
Choose time zone

How to Enable or Disable NTP Protocol

Enable the NTP protocol, use this command:

 [arun@localhost ~]$ timedatectl set-ntp yes 

And to disable NTP:

[arun@localhost ~]$ timedatectl set-ntp no

Perfect !!! We have learned how to set date & time on CentOS 7.

LEAVE A REPLY

Please enter your comment!
Please enter your name here