shell获取时间戳

    #明天凌晨 对应的毫秒时间戳
    tomorrow=`date -d next-day +%Y-%m-%d`
    timeStamp=`date -d "$tomorrow 00:00:00" +%s`
    currentTimeStamp=$(($timeStamp*1000+10#`date "+%N"`/1000000)) #将current转换为时间戳,精确到毫秒
    echo $currentTimeStamp
     
     
    #当前时间 对应的毫秒时间戳
    current=`date "+%Y-%m-%d %H:%M:%S"`
    timeStamp=`date -d "$current" +%s` 
    currentTimeStamp=$((timeStamp*1000+10#`date "+%N"`/1000000)) #将current转换为时间戳,精确到毫秒
    echo $currentTimeStamp
     
     
    #当前时间 对应的秒时间戳
    current=`date "+%Y-%m-%d %H:%M:%S"`
    timeStamp=`date -d "$current" +%s` 
    currentTimeStamp=$(((timeStamp*1000+10#`date "+%N"`/1000000)/1000)) #将current转换为时间戳,精确到秒
    echo $currentTimeStamp
原文地址:https://www.cnblogs.com/fb010001/p/14875745.html