得到前一年和下一个月的年份


Get year of previous and next months

在我的日历中,我需要将当前年份与前一年和下一年的年份进行比较,以确定月份是否需要重置为一月份,以及年份是否需要递增/递减。我已经有了这个来获取下一个&前几个月:

$prev_month = date('F',strtotime("last month"));
$next_month = date('F',strtotime("next month"));

有人知道怎么做吗?提前感谢- Tanner

$next_month_y = date('Y',strtotime("last month"));
$prev_month_y = date('Y',strtotime("next month"));