After the newly installed centOS system, there may be a time zone difference of 8 hours from the existing normal time due to time zone issues. We can reset the time zone through the corresponding command.
[root@master ~]# timedatectl
Local time: Mon 2021-01-25 07:03:18 UTC
Universal time: Mon 2021-01-25 07:03:18 UTC
RTC time: Mon 2021-01-25 07:03:32
Time zone: UTC (UTC, +0000)
System clock synchronized: no
NTP service: active
RTC in local TZ: no
1. View various statuses of time:
[root@master ~]# timedatectl
Local time: Mon 2021-01-25 14:57:51 CST
Universal time: Mon 2021-01-25 06:57:51 UTC
RTC time: Mon 2021-01-25 06:57:51
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a
2. List all time zones:
timedatectl list-timezones
3. Adjust the hardware clock to be consistent with the local clock, 0 is set to UTC time:
timedatectl set-local-rtc 1
4. Set the system time zone to Shanghai:
timedatectl set-timezone Asia/Shanghai