转载自:https://blog.csdn.net/m0_37886429/article/details/78477638
一、date 查看/设置系统时间
1、将日期设置为2017年11月3日
[root@linux-node ~]# date -s 11/03/17
2、将时间设置为14点20分50秒
[root@linux-node ~]# date -s 14:20:50
3、将时间设置为2017年11月3日14点16分30秒(MMDDhhmmYYYY.ss)
[root@linux-node ~]# date 1103141617.30
二、hwclock/clock 查看/设置硬件时间
1、查看系统硬件时钟
[root@linux-node ~]# hwclock --show 或者
[root@linux-node ~]# clock --show
2、设置硬件时间
[root@linux-node ~]# hwclock --set --date="11/03/17 14:55" (月/日/年时:分:秒) 或者
[root@linux-node ~]# clock --set --date="11/03/17 14:55" (月/日/年时:分:秒)
三、同步系统及硬件时钟
[root@linux-node ~]# hwclock --hctosys 或者
[root@linux-node ~]# clock --hctosys
备注:hc代表硬件时间,sys代表系统时间,以硬件时间为基准,系统时间找硬件时间同步
[root@linux-node ~]# hwclock --systohc或者
[root@linux-node ~]# clock --systohc
备注:以系统时间为基准,硬件时间找系统时间同步
原文:https://www.cnblogs.com/daiguangkun/p/9822523.html