要用root权限才可以修改
查询当前系统时间
[dreamren@dreamren ~]$ su root 密码: [root@dreamren dreamren]# date 2019年 05月 07日 星期二 20:44:30 CST
查询硬件时间
[root@dreamren dreamren]# hwclock --show 2019年05月07日 星期二 20时47分28秒 -0.823366 秒
假如上面的系统时间和硬件时间都不对,那我们进行时间的修改
更新系统年月日
[root@dreamren dreamren]# timedatectl set-time 2019-05-07 //更新系统时分秒 [root@dreamren dreamren]# timedatectl set-time 21:25:08 //更新时区(亚洲-中国-上海) [root@dreamren dreamren]# timedatectl set-timezone Asia/Shanghai //将硬件时钟调整为与系统时钟一致 [root@dreamren dreamren]# timedatectl set-local-rtc 1 //或使用下面的语句也可以 [root@dreamren dreamren]# hwclock --systohc --localtime //将日期写入CMOS [root@dreamren dreamren]# clock –w
可能在更新时间时出现不能更改的错误提示,这时我们把时间同步关闭,再去修改即可;
[root@dreamren dreamren]# timedatectl set-time 2019-05-07 Failed to set time: Automatic time synchronization is enabled [root@dreamren dreamren]# timedatectl set-ntp no
OK,完活!!
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END







![[Windows软件] 一键定时自动化任务神器 zTasker v1.99.8,支持语音报时+多项定时计划执行-追梦人](https://cdn.dreamren.cn/wp-content/uploads/2024/12/20250418124135873.gif)




