【发布时间】:2013-01-29 13:30:14
【问题描述】:
我有一个简单的变量,它将今天加一个月:
$endOfCycle = date("Y-m", strtotime("+1 month"));
今天是 2013 年 1 月,所以我希望回到 2013-02,但我得到的是 2013-03。我不知道为什么要跳到三月。
【问题讨论】:
-
see the Note in the Manual: 相对月份值是根据它们经过的月份长度计算的。一个例子是“+2 个月 2011-11-30”,它会产生“2012-01-30”。这是因为 11 月有 30 天,12 月有 31 天,总共有 61 天。