例如日期是 21/01/2015我想得到 22/02/2015(下个月日期从 21 增加到 22)
我是如何实现的?我正在使用 strtotime('+1 个月');输出:- 21/02/2015..这只会给我下个月的当前日期,即 21
嗯,我猜
strtotime('-1 day', strtotime('-1 month'))
或者,如果您确实需要下个月,而不是上个月,那么
strtotime('+1 day', strtotime('+1 month'))
如果相应的日期不存在(就像你在 1 月 31 日打电话一样),它会有有趣的工件,但我想无论如何都不清楚在这种情况下该怎么做。
试试下面:-
$end_date = mktime(0,0,0,date('m')+1,date('d')+1,date('Y'));
echo date('Y-m-d', $end_date);
我会送你
$day = date('d');
$month = date('m')+1;
$year = date('Y');
$nextDay = $day+1;
$nextMonth = $month + 1;
echo $nextDate = $nextDay.'/'.$nextMonth.'/'.$year;