Need to capture all dates between start date and End date.

Hi All,

I enter Start date and end date as parameters. I need to capture dates between start date and end date. Please let me know if you have any idea the same.

Thanks in advance.
Nagaraja Akkivalli.

You need to provide more info:

Dates entered, including format -- yyyy/mm/dd, or?
Capture from what? Are you trying to read through a file?
Can only answer if we know the format of the file and can see a sample.

Thanks for you response Joe.

I am entering dates in "dd/mm/yyyy" format. I will convert date into YYYYMMDD(20110301)format and append the same to filename(Mbr). Pass date appended file name(Mbr_20110301*) to ZIP files function to list all the files in the directory. Once files are listed, zip them.
I have a code to increment dates between "2 weeks ago" and "current date'(pasted below) but i want to do it between start date and end date. Note that, Start date and end date are my parameters.

#!/bin/sh
startdate=`/bin/date --date="2 weeks ago" +%Y%m%d`
currentdate=`/bin/date +%Y%m%d`
 
foldate="$startdate"
until [ "$foldate" == "$currentdate" ]
do
  foldate=`/bin/date --date="$foldate 1 day" +%Y%m%d`
echo "foldate $foldate"
done
exit 0
start_date="20110501"
end_date="20110401"
print=0

while [ 1 == 1  ];
do
    v_date=`eval date +"%Y%m%d" --date=\"$i day ago\"`;
    i=`expr $i + 1`;

    if [ $start_date == $v_date ]
    then
        print=1
    fi
    
    if [ $print == 1 ]
    then
        echo $v_date; 

    fi
    
    if [ $v_date == $end_date ]
    then
        break
    fi

done

This has worked for me

Thanks for your response, Kumaran. Will check this out.

Thanks much for your help, Kumaran,

I checked this code. This code is very similar to my code which I pasted above(i days ago/n weeks ago). However, I am able to connect to database and retrive all dates between start date and end date(wrote PL/SQL and checked it). I am unble to output all these dates into file since query was returning multiple values. How to output all dates into file?

How to read one date at a time from file? please help me.

Thanks and Regards
Nagaraja Akkivalli.