Calculate the number of days between 2 dates - bash script

I wrote the day calculator also in bash. I would like to now, that is it good so?

#!/bin/bash

datum1=`date -d "1991/1/1" "+%s"`
datum2=`date "+%s"`

diff=$(($datum2-$datum1))

days=$(($diff/(60*60*24)))

echo $days

Thanks in advance for your help!

Looks alright. What is it that you want to know exactly?

It doesn't need bash specifically, by the way.

What it does need is a modern version of GNU date, so if you take this script to a Solaris or AIX or other such system it won't work.

 
#/bin/ksh
 
# date format: yyyy-mm-dd
 
DATE1="2002-04-30"
DATE2="2006-12-02"
 
typeset -L4 y1 y2
typeset -Z -R2 mm dd
 
y1=$DATE1
y2=$DATE2
fy=$y1
my=$DATE1
my=${my#*-}
my=${my%-*}
 
c=0
d2=0
while [[ $y1 -le $y2 ]]
do
for mm in 1 2 3 4 5 6 7 8 9 10 11 12
do
[[ $y1 -eq $fy ]] && [[ $mm -lt $my ]] && continue
cal $mm $y1 | while read line
do
line=${line%%[a-zA-Z]*}
[[ -n ${line:-""} ]] && {
for dd in $line
do
(( c = c + 1 ))
[[ "$y1-$mm-$dd" = "$DATE1" ]] && { d1=$c ; }
[[ "$y1-$mm-$dd" = "$DATE2" ]] && { d2=$c ; break ; }
done
}
[[ ${d2:-0} -gt 0 ]] && break
done
[[ ${d2:-0} -gt 0 ]] && break
done
(( y1 = y1 + 1 ))
done
(( days = d2 - d1 ))
echo $days