Date math in the shell

hooboy! The `date` man page gives this example

$ date --date='@2147483647'

but nowhere does it document use of the `@` symbol. However, you can see that this will let you do date math, e.g., compute the interval between two dates:

THEN=`date`

... time goes by ...

NOW=`date`
SECS=$(( `date +%s -d $NOW` - `date +%s =d $THEN` ))
echo Elapsed hh:mm:ss beween NOW and THEN is $((SECS - 16*3600))

'''Note''' 16*3600 is and adjustment for the timezone offset, automating this computation is an exercise left to the reader.