CentOS is installed for a variety of reasons need to be modified after the 7 time zone to the time synchronization server or device.
Have a command in CentOS 7 timedatectl help us to modify the server’s time zone.
First of all, we can use the timedatectl command to view the current server time zone settings:
Local time: Wed 2015-07-22 16:48:14 CST
Universal time: Wed 2015-07-22 08:48:14 UTC
Timezone: Asia/Shanghai (CST, +0800)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: yes
DST active: n/a
Can see all the settings such as server time, time zone and NTP
We can use the command “timedatectl list-timezones” view all time zones
View time zone when you are finished, we can use the command “timedatectl set-timezone time zone”
For example, we need to set the time zone in Shanghai: “timedatectl set-timezone Asia/Shanghai”
After you set the time zone of course, you can also set the NTP server on and off
Turn on NTP: “timedatectl set-NTP Yes”
Turn off NTP: “timedatectl set-NTP no”
Timedatectl command can set the date and time
Date: “timedatectl set-time YYYY-MM-DD”
Set time: “timedatectl set-time HH:MM:SS”
Leave a Reply