From:             henrik at mindlocker dot no
Operating system: Mac OS X Server 10.3.3/Darwin7.3
PHP version:      4.3.5
PHP Bug Type:     Date/time related
Bug description:  strtotime behaving erraticly in month change

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 bug report at http://bugs.php.net/?id=27793&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27793&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27793&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27793&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27793&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27793&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27793&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27793&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27793&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27793&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27793&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27793&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27793&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27793&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27793&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27793&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27793&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27793&r=float

Reply via email to