根据星期获取月份日期
- /**
- * 根据星期获取月份日期
- * @param int $weenNum 星期0-6
- * @return array $days 返回日期数组
- */
- public function getDateByWeek($weekNum,$month,$year)
- {
- $totalDays=date('t',strtotime(mktime(0,0,0,$month,1,$year)));//计算月份总天数
- $days=array();
- for($day=1;$day<=$totalDays;$day++)
- {
- $mkTime=mktime(0,0,0,$month,$day,$year);
- if(date('w',$mkTime)==$weekNum){
- $days[]=date('Y-m-d',$mkTime);
- }
- }
- return $days;
- }
复制代码
|