if you are using Linux, below is my generic script for calculating # of days different between 2 given dates. using a -today flag as many calcs have today's date as one of the inputs. It should accept about any UNIX date format, at least all I've tried.
#!/usr/bin/bash
if [ $# -ne "2" ]; then
echo "incorrect format: $0 date date"
echo "example: ./list_times 01/16/2009 04/01/2009"
echo "example: ./list_times 2009-01-16 04/01/2009"
exit 1
fi
if [ $2 = "-today" ]; then
TODAY=`date +%m/%d/%Y`
/usr/bin/echo -n $1 " "
echo "("$(date -d $1 +%s)-$(date -d $TODAY +%s)")/86400" | bc
else
echo "("$(date -d $1 +%s)-$(date -d $2 +%s)")/86400" | bc
fi
# for your example, I simply created a file called emp, and run it through a for loop, but should give you an idea how to incorporate into a script.
for EMP in `awk '{ print $2 }' emp`
do
./list_times $EMP -today
done