ID:               50682
 Updated by:       ras...@php.net
 Reported By:      keefeg at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Date/time related
 Operating System: FreeBSD 6.2
 PHP Version:      5.2.12
 New Comment:

That's because you are asking for the same day last month which doesn't

exist since November doesn't have 31 days.  November 31 gets normalized

to Dec 1.  If you are using last/next make sure you feed it a recurring

starting point.  Like the 1st of the sequence, in this case the 1st of

the month.


Previous Comments:
------------------------------------------------------------------------

[2010-01-06 20:28:57] keefeg at gmail dot com

Description:
------------
strtotime does not handle the "last month" parameter correctly all the
time.

Reproduce code:
---------------
---
>From manual page: function.strtotime#Description
---
$ny = strtotime("31 December 2009");
echo "this month: " . date('Ym', strtotime("now", $ny)) . "\n";
echo "last month: " . date('Ym', strtotime("last month", $ny)) . "\n";


Expected result:
----------------
I would like it to produce this result:

this month: 200912
last month: 200911


Actual result:
--------------
It prints this result:

this month: 200912
last month: 200912



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=50682&edit=1

Reply via email to