可能重复:
PHP date() and strtotime() return wrong months on 31st什么事会发生在PHP的日期功能
我有这样的代码,它输出一些奇怪的事情,我认为。所以,我在这里做错了什么。
<?php
$sP1 = date('m Y');
$sP2 = date('m Y', strtotime('+01 month'));
$sP3 = date('m Y', strtotime('+02 month'));
$sP4 = date('m Y', strtotime('+03 month'));
echo $sP1.'<br>';
echo $sP2.'<br>';
echo $sP3.'<br>';
echo $sP4.'<br>';
?>
这个输出
05 2012
07 2012
07 2012
08 2012
我认为第二个应该是
06 2012
有人知道任何解决办法吗?
见在这个问题上接受的答案:http://stackoverflow.com/questions/9058523/php-date-and-strtotime-return-wrong -months-on-31st – Andy
非常感谢你.. :) – Prashank