Re: how do you get a list of all dates between two dates more than a day apart?
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.php archive

Re: how do you get a list of all dates between two dates more than a day apart?

From: Adam Plocher <aplocher@gmail.com>
Date: Sat Jan 21 2006 - 00:03:57 CET

How about something like this....

<?
$start = "2005-05-05";
$end = "2005-06-05";

$init_date = strtotime($start);
$dst_date = strtotime($end);

$offset = $dst_date-$init_date;

$dates = floor($offset/60/60/24) + 1;

for ($i = 0; $i < $dates; $i++)
{
        $newdate = date("Y-m-d", mktime(12,0,0,date("m", strtotime($start)),
(date("d", strtotime($start)) + $i), date("Y", strtotime($start))));
        echo $newdate ."<br>";
}
?>
Received on Tue Feb 7 21:02:13 2006