Looping through dates

From: Date: Fri, 19 Jul 2002 13:06:14 +0000
Subject: Looping through dates
Groups: php.windows 
Request: Send a blank email to php-windows+get-14842@lists.php.net to get a copy of this message
I'm trying to create a simple app that loops through Sundays displaying the date until the current date is reached. I have the loop working nicely but I'm unsure how to compare the result to the current date. I put a mock loop together to get the basics working: <? $dateCalc=7; for($i=1;$i<8;$i++){ $date1=mktime(0,0,0,06,30,2002); $date2=strtotime("+$dateCalc days",$date1); $date2=date("l F d Y",$date2); $dateCalc2=$dateCalc+6; $date3=strtotime("+$dateCalc2 days",$date1); $date3=date("l F d Y",$date3); echo "$date2 - $date3 <br>"; $dateCalc+=7; } This goes through and prints out each week from Sunday to Saturday. I have the loop cycling a hardcoded 8 times. I would like to have it loop until it reaches the current week. How can I do that? Ron

« previous php.windows (#14842) next »