时间:2021-07-01 10:21:17 帮助过:5人阅读
$startdate = '2014-08-12';$enddate = '2015-10-20';$s = strtotime($startdate);$e = strtotime($enddate);$num = (date('Y',$e)-date('Y',$s)-1)*12+(12-date('m',$s)+1)+date('m',$e);$months = array();for($i=0; $i<$num; $i++){ $d = mktime(0,0,0,date('m',$s)+$i,date('d',$s),date('Y',$s)); $months[] = date('Y-m',$d);}print_r($months);
太感谢了!楼上牛人!