如何将脚本格式的unix时间转换成字符串

前端之家收集整理的这篇文章主要介绍了如何将脚本格式的unix时间转换成字符串前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
将字符串转换为unix时间:
 date --date "2012-02-13" +%s

我该怎么做相反呢?格式unixtime到字符串?

您可以使用date –date @datetime:
[foo@bar ~]$date --date "2012-02-13" +%s
1329055200
[foo@bar ~]$date --date @1329055200
Mon Feb 13 00:00:00 EST 2012
[foo@bar ~]$date --date @1329055200 +"%Y-%m-%d"
2012-02-13

我不知道’@xxxx’在哪里被记录!

原文链接:https://www.f2er.com/bash/386699.html

猜你在找的Bash相关文章