function dates_month($month,$year,$day_name) { $num = cal_days_in_month(CAL_GREGORIAN, $month, $year); $dates_month=array(); for($i=1;$i<=$num;$i++) { $mktime=mktime(0,0,0,$month,$i,$year); $date=date("d-M-Y",$mktime); // If your day is come with Mon, Tue, etc.. /*$date_day = date('D',$mktime); if($date_day == $day_name) { $dates_month[$i]=$date.'day'.$date_day; } */ // If your day is come with 1,2, etc.. $date_day = date('w',$mktime); if($date_day == $day_name) { $dates_month[$i]=$date; } } $dates = array_values($dates_month); return $dates; }
echo"<pre>"; print_r(dates_month(2,2015,2)); echo"</pre>";
No comments:
Post a Comment
Thanks for visit blog.