2015-05-22 120 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; }
相關問題