Time configuration command timedatectl added in CentOS7
Several clock definitions:
Real-time clock RTC real-time clock
The hardware clock is specified. It is generally a special circuit on the motherboard. It is used to record the power of a battery. It is not affected by the server's enabling or disabling, but the operating system's disabling.
System clock
The internal clock of the operating system. The initial value is the real-time clock, which is maintained by the kernel. It has nothing to do with RTC after the system is started.
Coordinated Universal Time (UTC) Universal clock
The system time is always UTC, and is converted to the local time when the application is using it. The local time is actually your own time zone, including the time zone. In practice, RTC can be set to the local time in UTC, generally, UTC is supported.
Use the timedatectl command:
View Current Time
[Root @ localhost ~] # Timedatectl
Local time: Mon 2015-03-23 15:31:02 CST
Universal time: Mon 2015-03-23 07:31:02 UTC
RTC time: Mon 2015-03-23 07:31:02
Timezone: Asia/Shanghai (CST, + 0800)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: n/
Modification time
Timedatectl set-time 23:36:00
Modification date
Timedatectl set-time YYYY-MM-DD
Use this command to reset the time To 00:00:00
Run the following command to modify the time and date:
Timedatectl set-time '2017-03-25 23:26:00'
Modify Time Zone
List available time zones
Timedatectl list-timezones
Modify Time Zone
Timedatectl set-timezone time_zone
Set whether to synchronize with the NTP server
Timedatectl set-ntp yes
Do not want to synchronize with NTP to no
You can set the remote server time by adding the-H parameter.
You can also use the date and hwclock commands. This is a common command, which is not described in detail.