shell 通过 data命令实现 时间戳 和 时间 相互转换

#!/bin/bash

starttime=$(date "+%Y-%m-%d 00:00:00" -d "-1 day")
endtime=$(date "+%Y-%m-%d 23:59:59" -d "-1 day")

echo ${time1}

starttime1=`date -d "$starttime" +%s`
endtime1=`date -d "$endtime" +%s`

echo -e "时间区间是	 $starttime - $endtime"
echo -e "时间戳区间	 $starttime1 - $endtime1"
技术男一枚,喜欢做技术分享,把学习的过程,以及遇到问题的解决过程都愿意分享给大家,博客中如有不足,请留言或者联系博主,感谢。 邮箱: sijiayong000@163.com Q Q: 601566386
原文地址:https://www.cnblogs.com/winstom/p/15251769.html