Snippet Name: Find days between dates one Description: A simple way to find all days between a pair of dates. Also see:» Convert UK Dates To mySQL Format Dates » Delete files older than 'X' » String to Date » Month, Day, Year dropdown boxes » Calculate date of Easter Sunday » Define a schedule of holidays » Calendar for any month any year » Add and Subtract dates » Basic PHP Calendar » Convert Standard time to 24-hour time ... » What Season Is It? » Delete by date » Days in month #2 » Days in month one » Count days between dates » Build Date Select Boxes Comment: (none) Language: PHP Highlight Mode: PHP Last Modified: March 16th, 2009
Description: A simple way to find all days between a pair of dates.
Also see:» Convert UK Dates To mySQL Format Dates » Delete files older than 'X' » String to Date » Month, Day, Year dropdown boxes » Calculate date of Easter Sunday » Define a schedule of holidays » Calendar for any month any year » Add and Subtract dates » Basic PHP Calendar » Convert Standard time to 24-hour time ... » What Season Is It? » Delete by date » Days in month #2 » Days in month one » Count days between dates » Build Date Select Boxes
<?PHP $dt=ARRAY("27.01.1985","12.09.2008"); $dates=ARRAY(); $i=0; WHILE(STRTOTIME($dt[1])>=STRTOTIME("+".$i." day",STRTOTIME($dt[0]))) $dates[]=DATE("Y-m-d",STRTOTIME("+".$i++." day",STRTOTIME($dt[0]))); FOREACH($dates AS $value) ECHO $value."<br />"; ?>