2015-05-22 166 views

回答

0

嗨每个身体一些如何得到解决方案,它在下面给出。 (“M”)。“”.date('Y')。“”));第一个星期日。 $ weekArray = getfstlastdayOfWeekofmonth($ fstSunday); echo'

'; 
       print_r($weekArray);

function getfstlastdayOfWeekofmonth($paramFstSundayofMonth) { $fstSunday = $paramFstSundayofMonth; //echo 'last date of the week-'.$oneWeekLater = date('d-m-Y', strtotime('+1 week',strtotime($fstSunday))); $countMnth = date("t",strtotime($fstSunday)); $dayOfmonth = date("d",strtotime($fstSunday)); if($countMnth==31 && $dayOfmonth <= 3) $countmonth = 5; else $countmonth = 4; $weekArray = array(); for($i=0;$i<$countmonth;$i++) { $oneWeekLater = date('d-F-Y', strtotime('+1 week',strtotime($fstSunday)-1)); $weekArray[] = array('fstdayWeekOfmonth'=> $fstSunday,'lastDayWeekOfmonth'=>$oneWeekLater) ; $fstSunday = date('d-F-Y', strtotime('+1 week',strtotime($fstSunday))); } // echo '<pre>'; return $weekArray; }
相关问题