I'm posting a snippet of code which prints each date within a week.  For
example on the day of 10/21/01 it will print the dates 10/21/01, 22, 23, 24,
25, 26, and 27.

The problem I am having is on the week of 10/28/01 it will print 10/28
twice.  for example 28,28,29,30,31,1,2,3.  As far as I can tell every other
date seems to work fine except for the week of the 28th, where I get the
28th twice.  I'm hoping someone will take a quick look at the code below and
maybe have an idea as to why this is occuring or see something I dont see.

I greatly appreciate any help or advince.

Thanks.



<?
$yr = "2001";
$mnth = "10";
$dy = "28";

$sunday_stamp =
mktime(0,0,0,$mnth,$dy-date("w",mktime(0,0,0,$mnth,$dy,$yr)),$yr);
$last_sunday = date("Y-m-d", $sunday_stamp);
$next_saturday =
date("Y-m-d",mktime(0,0,0,$mnth,$dy+6-date("w",mktime(0,0,0,$mnth,$dy,$yr)),
$yr));

$next_day = $last_sunday;
$next_stamp = $sunday_stamp;
while($next_day <= $next_saturday)
        {
        $newsplit = explode("-", $next_day);
        $date = date("m/d/y",
mktime(0,0,0,$newsplit[1],$newsplit[2],$newsplit[0]));
        $dayoweek = date("l",
mktime(0,0,0,$newsplit[1],$newsplit[2],$newsplit[0]));

        echo "$dayoweek $date<BR>";

        $next_stamp = $next_stamp + 86400; // stamp plus # of seconds in a day
        $next_day = date("Y-m-d",$next_stamp);;
        }
?>


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to