CentOS 7 Time Zone settings
After CentOS 7 is installed, You need to modify the time zone of the device for various reasons or synchronize the Time of the server.
In CentOS 7, there is a command timedatectl to help us modify the time zone of the server.
First, you can use the timedatectl command to view the time zone settings on the current server:
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/
You can see all the settings in the current server, such as time, time zone, NTP, etc.
Run the "timedatectllist-timezones" command to view all time zones.
After checking the time zone, we can run the "timedatectl set-timezone" command"
For example, we need to set the time zone to Shanghai: "timedatectl set-timezone Asia/Shanghai"
You can also enable or disable the NTP server after setting the time zone.
Enable NTP: "timedatectl set-ntp yes"
Disable NTP: "timedatectl set-ntp no"
Of course, the timedatectl command can also set the date and time
Set date: "timedatectl set-time YYYY-MM-DD"
Set time: "timedatectl set-time HH: MM: SS"