3

如何在给定月份后获取月份名称。所以六月,我想要七月

我试过了:

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

这个显示一月,这显然是错误的,我正在寻找七月。

那么我将如何获得前一个月?

我试过了

$prev_month = date('F',strtotime('June - 1 month'));
4

2 回答 2

11
$next_month = date('F',strtotime('June + 1 month'));

或者

$next_month = date('F',strtotime('June next month'));

编辑

$next_month = date('F',strtotime('June last month'));
于 2012-05-09T10:33:20.590 回答
1
echo date('F',strtotime('June + 1 month'));
于 2012-05-09T10:35:58.457 回答