Linux中date命令的各种实用方法--转载
4、以下范例说明如何调整服务器的时间ntpdate 210.72.145.44?#将服务器时间调整为正常时间,210.72.145.44 是国家授时中心服务器IP地址[root@RHEL601 tmp]# ntpdate 210.72.145.4419 Jul 13:07:07 ntpdate[15150]: adjust time server 210.72.145.44 offset -0.020920 sec date 121212122012?#将时间设置为2012年 12月 12日 星期三 12:12:00,date后面的数字代表月日时分年,还可以加秒,需要后面跟英文状态下的句号字符".",例如:121212122012.12[root@RHEL601 tmp]# date 1212121220122012年 12月 12日 星期三 12:12:00 CST[root@RHEL601 tmp]# date 121212122012.122012年 12月 12日 星期三 12:12:12 CST [root@RHEL601 tmp]# date `date -d "1 day ago" +%m%d%H%M%Y.%S`2012年 07月 18日 星期三 20:13:04 CST[root@RHEL601 tmp]# date2012年 07月 18日 星期三 20:13:10 CST[root@RHEL601 tmp]# date `date -d "3 days ago" +%m%d%H%M%Y.%S`2012年 07月 15日 星期日 20:13:18 CST[root@RHEL601 tmp]# date `date -d "5 days ago" +%m%d%H%M%Y.%S`2012年 07月 10日 星期二 20:13:28 CST[root@RHEL601 tmp]# date `date -d "$((3600*24)) seconds ago" +%m%d%H%M%Y.%S`2012年 07月 09日 星期一 20:13:39 CST[root@RHEL601 tmp]# date `date -d "$((3600*24)) seconds ago" +%m%d%H%M%Y.%S`2012年 07月 08日 星期日 20:14:01 CST[root@RHEL601 tmp]# ntpdate 210.72.145.4419 Jul 20:14:15 ntpdate[26846]: step time server 210.72.145.44 offset 950404.037565 sec 参考页面:1、写在最后,由于博客的编辑功能限制,某些字符显示在页面上不是很明显,特意将个人的本地同名总结文档上传上来,如果读者看着页面中的不习惯,可以下载附件阅读。? 本文出自 “” 博客,请务必保留此出处 (编辑:瑞安网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |