`
yidongkaifa
  • 浏览: 4062560 次
文章分类
社区版块
存档分类
最新评论

linux命令行 UTC时间戳与时间互换

 
阅读更多

我们自己写的日志中经常有UTC时间戳(long 类型时)。需要转为人可识别的时间,2012-xx-xx


Linux的Date命令已经提供了这样的功能。


时间->时间戳


[hpc@ming-archhost ~]$ date --date "2012-12-21" +%s
1356019200



时间戳->时间

[hpc@ming-archhost ~]$ date --date "1970-01-01 UTC 612889200 seconds"
Sun Jun 4 00:00:00 CDT 1989

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics