hello head

function timeDiff()
{
    var=("" "")
    i=0
    for str in $*
    do
        _year=${str:0:2}
        _month=${str:2:2}
        _day=${str:4:2}
        _time=${str:7}
        var[$i]="20"${_year}"-"${_month}"-"${_day}" "${_time}
        let i++
    done
    strEnd=`date -d "${var[0]}" '+%s.%N'`
    strStart=`date -d "${var[1]}" '+%s.%N'`
    echo ${strEnd} ${strStart} | awk '{print  $1-$2}' | more
}
timeDiff "$strEnd" "$strStart"

 

posted on 2018-11-27 21:58  gardonkoo  阅读(162)  评论(0编辑  收藏  举报

hello foot