Quote:
Originally Posted by jidsh
I need to validate that difference between the two dates is always less than or equal to 60 days.
|
If using the external command
date is not against the rules, and provided that you are using
date from
GNU Coreutil then:
Code:
colemar@deb:~$ cat days_between
#!/bin/sh
typeset -i days_between
function days_between {
days_between=$((($(date -d $2 +%s)-$(date -d $1 +%s))/86400))
}
days_between $1 $2
echo $days_between
colemar@deb:~$ ./days_between 2008-04-22 2009-04-22
365