用date命令使unix时间戳与标准时间格式相互转换
date命令可以将标准的时间格式转换成unix时间戳
例如:
[root@haifeng-test ~]# date -d "2011-03-02 15:00" +%s
1299049200
同样也可以使用date命令将unix时间戳转换成标准的时间格式
例如:
[root@haifeng-test ~]# date -d '1970-01-01 UTC 1299049200 seconds'
2011年 03月 02日 星期三 15:00:00 CST
转载于:https://blog.51cto.com/lhflinux/505256