date命令进行纪元秒与时间的转换

Life is short , play more!
本文来自lihao's Blog,转载请注明。

Use the date command in linux to transform from utc second to date.

Display the utc second since 1970-01-01 00:00:00 UTC.

To now.
#date +%s (lower case)
1253515801

To the date we specifeid.

# date -d “20091001 00:00:00” +%s
1254326400

And vice versa.

If we got a utc seconde value , and change to the date recogenized.

# date -d @1254326400
2009年 10月 01日 星期四 00:00:00 CST


发表评论

电子邮件地址不会被公开。 必填项已用*标注