Edit report at https://bugs.php.net/bug.php?id=27793&edit=1

 ID:                 27793
 Comment by:         ian_dunn at yahoo dot com
 Reported by:        henrik at mindlocker dot no
 Summary:            strtotime behaving erraticly in month change
 Status:             Not a bug
 Type:               Bug
 Package:            Date/time related
 Operating System:   Mac OS X Server 10.3.3/Darwin7.3
 PHP Version:        4.3.5
 Block user comment: N
 Private report:     N

 New Comment:

Since this is reported as a bug so often, it might make sense to update the 
documentation to warn developers about this unexpected/unintuitive behavior. 
Regardless of whether you think it's a bug or not, it's clearly something that 
many developers stumble over, so it should be prominently documented.


Previous Comments:
------------------------------------------------------------------------
[2004-03-31 04:49:32] der...@php.net

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

Already reported atleast *5* times.

------------------------------------------------------------------------
[2004-03-31 03:34:24] henrik at mindlocker dot no

Description:
------------
strtotime("- x month") will not work properly when 
around a month change. The following code example was 
run on 31.march. I have seen the previous bug reports 
that indicate that month is really an alias for 30.5 
days. However, this causes problems when you need to 
correctly iterate (dynamically) with the month keyword. 
It should iterate correctly when its specified as month, 
if not my opinion is that implementations should use 
strtotime("- ".$num*"30.5"." days");

Reproduce code:
---------------
for( $c=0;$c<12;$c++ )
 echo date("F",strtotime("-".$c." month"))."<br>";

Expected result:
----------------
March
February
Januar
December
November
October

Actual result:
--------------
March
January
December
December
October
October
...


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



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

Reply via email to