PHP指定日期获取月份
//code function getMonthsInRange($startDate, $endDate) { $months = array(); while (strtotime($startDate) <= strtotime($endDate)) { $month = date('Y', strtotime($startDate))."-".date('M', strtotime($startDate)); array_push($months,$month); $startDate = date('d M Y', strtotime($startDate.'+ 1 month')); } return $months; }