#22486 [NEW]: strtotime +1/-1 Month bug

From: Date: Sat, 01 Mar 2003 05:34:53 +0000
Subject: #22486 [NEW]: strtotime +1/-1 Month bug
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-34566@lists.php.net to get a copy of this message
From: drwav at hotpop dot com Operating system: Win32 PHP version: 4.2.3 PHP Bug Type: Date/time related Bug description: strtotime +1/-1 Month bug when strtotime is asked to create a timestaml +1 month in the future, and is given a timestamp that happens on a day that does not exist in the next month. A timestamp a few days beyond one month in the future is created. Example: <?php $now = strtotime("2003-01-30"); $nextmonth = strtotime("+1 month", $now); print date("Y-m-d", $nextmonth); ?> the output from this script is 2003-03-02 since February has no 30th day, apparently strtotime just adds 30 days to whatever timestamp it is given to go one month in the future, hence March 2nd. -- Edit bug report at http://bugs.php.net/?id=22486&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=22486&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=22486&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=22486&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=22486&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=22486&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=22486&r=support Expected behavior: http://bugs.php.net/fix.php?id=22486&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=22486&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=22486&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=22486&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22486&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=22486&r=dst IIS Stability: http://bugs.php.net/fix.php?id=22486&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=22486&r=gnused

« previous php.bugs (#34566) next »