【Centos】Centos7 修改硬件时间和系统时间

查询当前系统时间

[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,完活!!

温馨提示:本文最后更新于2025-06-02 14:26:16,文章具有时效性,若有错误或失效,请在下方留言或联系站长邮箱
本站资源均为网友推荐收集整理而来,请勿商业运营,仅供学习和研究,请在下载后24小时内删除!!
© 版权声明
THE END
喜欢就支持一下吧
点赞6 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容