CentOS7的时间分为系统时间和硬件时间。二者都修改,重启系统(init 6 )才会永久生效。
修改步骤如下
[root@localhost]: date #查看当前系统时间
[root@localhost]: date -s "2021-03-02 19:10:30 #修改当前系统时间
[root@localhost]: hwclock --show #查看硬件时间
[root@localhost]: hwclock --set --date "2021-03-02 19:10:30" #修改硬件时间
[root@localhost]: hwclock --hctosys #同步系统时间和硬件时间
[root@localhost]: clock -w #保存时钟
重启系统(init 6)后便发现系统时间被修改了