Get the time difference between two times, in hours, minutes and seconds

This one’s a no brainer.

date2=$(date +"%s")
#Wait for some time
date2=$(date +"%s")
echo "Time difference is $(($diff / 3600)) hours $(($diff / 60)) mins $(($diff % 60)) secs."


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.