Ch-center
Tutorials for centos 7
#157
RHEL 7 offers another utility to configure and display date and time information, timedatectl. This utility is part of the systemd system and service manager. With the timedatectl command you can :
  • Change the current date and time
  • Set the time zone
  • Configure NTP
If you run timedatectl without any options, you would get an output similar to below :


 
Code: Select all
# timedatectl 
      Local time: Sun 2017-09-24 13:16:39 IST
  Universal time: Sun 2017-09-24 07:46:39 UTC
        RTC time: Sun 2017-09-24 07:46:39
       Time zone: Asia/Kolkata (IST, +0530)
     NTP enabled: no
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a
The above output shows – local time, universal time, RTC time, time zone, NTP configuration and Daylight Savings Time (DST)
Change the current date and timeUse the set-time argument to change the current date and the current time.1. To change the date, use the following syntax:
Code: Select all
timedatectl set-time [YYYY-MM-DD]

2. To change the current time, use the following syntax. Enter the hour by using a 24-hour clock.
Code: Select all
timedatectl set-time [HH:MM:SS]

3. To configure your system to maintain the clock in the local time, use the following command:
Code: Select all
timedatectl set-local-rtc yes

4. To configure your system to use UTC, use the following command:
Code: Select all
# timedatectl set-local-rtc no
Change Time ZoneUse the following command to list all available time zones:
Code: Select all
# timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Bamako
.....

Use the set-timezone argument to change the time zone. The following example changes the time zone to Asia/Kolkata:
Code: Select all
timedatectl set-timezone Asia/Kolkata
Configuring NTPUse the set-ntp argument to enable or disable automatic synchronization of your system clock with a remote server over the Network Time Protocol (NTP). Use the following command to enable this feature:
Code: Select all
timedatectl set-ntp yes
Use the following command to disable this automatic synchronization over NTP:
Code: Select all
timedatectl set-ntp no
 
a-zet
SPECIAL DEDICATED SERVER OFFER - LIMITED STOCK LEFT

Intel® Xeon 2.53GHz [...]