Click to See Complete Forum and Search --> : subtract dates


BrutusUnix
03-01-2006, 03:59 PM
I have created a form where someone enters in a begining date and an ending date in the format of mdY.
I'm trying to get how to create a loop counting through the days between:
this is to give you the idea if what I'm trying to do but don't know how to:
$startdate = 02132006;
$enddate = date('mdY');
for($i = $startdate; $i < $enddate; $i + date('d+1'){
echo $i
}

how would I print all the dates in the format of mdY inbetween the two dates?

Thanks

SpectreReturns
03-01-2006, 06:42 PM
Might I suggest using the Ymd format for doing math, that way years and months are easily calculated properly, and we can use substrings later to figure it out (plus it's closer to the ISO standard date format).