note 100247 deleted from function.date by rquadling

From: Date: Mon, 04 Oct 2010 11:09:32 +0000
Subject: note 100247 deleted from function.date by rquadling
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-172930@lists.php.net to get a copy of this message
Note Submitter: imran at t555 dot net ---- Sorry, my last post had a mistake in it, this should work: <?php function dates_inbetween($date1, $date2){ $day = 60*60*24; $date1 = strtotime($date1); $date2 = strtotime($date2); $days_diff = round(($date2 - $date1)/$day); // Unix time difference devided by 1 day to get total days in between $dates_array = array(); $dates_array[] = date('Y-m-d',$date1); echo $days_diff."\n"; for($x = 1; $x < $days_diff; $x++){ $dates_array[] = date('Y-m-d',($date1+($day*$x))); } $dates_array[] = date('Y-m-d',$date2); return $dates_array; } ?>

« previous php.notes (#172930) next »