linux shell之获取时间戳毫秒级

xingyun86 2019-7-15 1556

current=`date "+%Y-%m-%d %H:%M:%S"`  
timeStamp=`date -d "$current" +%s`   
#将current转换为时间戳,精确到毫秒  
currentTimeStamp=$((timeStamp*1000+10#`date "+%N"`/1000000)) 
echo $currentTimeStamp

10#表示转换为十进制做运算

(错误信息: value too great for base (error token is "017800000"))

×
打赏作者
最新回复 (0)
只看楼主
全部楼主
返回