Daysapart.sh
From WikiPaul - Paul Swanson's wiki
I made a little bash script to tell me the difference between two days in Linux. It takes the one or two dates, converts them into seconds, subtracts them, divides by the number of seconds in a day, then prints it out.
#!/bin/bash if [ $# -ne 1 ] && [ $# -ne 2 ] then echo "Usage: $0 date1 [date2]" echo " Standard date format \(mm/dd/yy\)" echo " Omitting second date defaults to present date" echo " You may omit years" exit fi DIFF=$(( (`date -d "$2" +%s` - `date -d "$1" +%s`) / 86400 )) echo "$DIFF days apart"
BlogMarks
del.icio.us
digg
Fark
Furl
Newsvine
reddit
Segnalo
Simpy
Slashdot
smarking
Spurl
Wists