#36912 [NEW]: strtotime subtracting months

From: Date: Wed, 29 Mar 2006 11:35:17 +0000
Subject: #36912 [NEW]: strtotime subtracting months
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-95065@lists.php.net to get a copy of this message
From: epilepticfridgeboy at hotmail dot com Operating system: debian PHP version: 5.1.2 PHP Bug Type: Date/time related Bug description: strtotime subtracting months Description: ------------ Subtracting a month using strtotime does not always subtract a month. Reproduce code: --------------- <?php print date('Y-m-d', strtotime('-1 month')); ?> Expected result: ---------------- Assuming the code is run on 2006-03-29, I would expect the result to be 2006-02-28, which is one month ago. Actual result: -------------- 2006-03-01 This is not one month ago. This has been reported as a bug before but marked as "Bogus" - no idea how not subtracting one month from a date correctly is bogus... and I wasn't allowed to add this to the notes system in the manual to warn others about this odd behaviour., so here it is again as a bug report. -- Edit bug report at http://bugs.php.net/?id=36912&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36912&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36912&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36912&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=36912&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=36912&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=36912&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=36912&r=needscript Try newer version: http://bugs.php.net/fix.php?id=36912&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=36912&r=support Expected behavior: http://bugs.php.net/fix.php?id=36912&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=36912&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=36912&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=36912&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36912&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=36912&r=dst IIS Stability: http://bugs.php.net/fix.php?id=36912&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=36912&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=36912&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=36912&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=36912&r=mysqlcfg

« previous php.bugs (#95065) next »