/**
* [getMonthNum description]
* @Author huowj
* @DateTime 2019-10-29T11:05:49+0800
* @param [type] $date1 [description]
* @param [type] $date2 [description]
* @param string $tags [description]
* @return [type] [description]
*/
public function getMonthNum( $date1, $date2, $tags='-' ){
$date1 = explode($tags,$date1);
$date2 = explode($tags,$date2);
// return abs($date1[0] - $date2[0]) * 12 + abs($date1[1] - $date2[1]);
return abs($date1[0] - $date2[0]) * 12 - $date2[1] + abs($date1[1]);
}
PHP判斷兩個日期之間相差多少個月份
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.