php计算两个日期相差的月份
$start = new DateTime('2018-11-20'); $end = new DateTime('2019-11-15'); $diff = $start->diff($end); $diff_month = $diff->format('%y')*12+$diff->format('%m');
- 上一篇 »PHP 日期比较
- 下一篇 »PHP的time函数返回时间不正确
$start = new DateTime('2018-11-20'); $end = new DateTime('2019-11-15'); $diff = $start->diff($end); $diff_month = $diff->format('%y')*12+$diff->format('%m');