Aşağıda belirtilen kodu sunulmuştur, çıkış (aşağıya bakınız). 2009/11/01 sonra yerine 2009/12/01 ve 2009/11/30 ve 2009/12/30 tarafından bulunuyor izleyin neden benim soru. 2009/06/01 ~ 2009/11/01 hiçbir sorun yoktur.
output
2009/06/01
2009/07/01
2009/08/01
2009/09/01
2009/10/01
2009/11/01
2009/11/30
2009/12/30
Benim kod
<?php
$startdate = "2009/06/01";
$enddate = "2009/12/31";
$start = strtotime($startdate);
$end = strtotime($enddate);
$currentdate = $start;
while($currentdate < $end)
{
$cur_date = date('Y/m/d',$currentdate);
$month = date('m', $currentdate);
$year = date('Y', $currentdate);
$monthLength = daysOfMonth($month, $year);
$currentdate += $monthLength;
echo $cur_date . "<br />";
}
function daysOfMonth($month, $year)
{
return (86400 * date("t", strtotime($year."-".$month."-01")));
}
?>