[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

difference in seconds between two formatted dates ...



dt00=$(date +%Y%m%d%H%M%S)
echo "// __ \$dt00: |${dt00}|"

... after some long processing for which seconds would be exact
enough, then I would like to get the seconds elapsed since dt00, like
this:

dt02=$(date +%Y%m%d%H%M%S)
echo "// __ \$dt02: |${dt02}|"

you get seconds in dt00 and dt02 and then the difference. You can't
go: $(( dt02 - dt00 )) because bash Arithmetic is 10-based.

I am pretty sure there is such a thing in bash, but I can't find it in
my scripts.

lbrtchx


Reply to: