note 45270 added to function.strtotime

From: Date: Tue, 31 Aug 2004 19:03:10 +0000
Subject: note 45270 added to function.strtotime
Groups: php.notes 
Request: Send a blank email to php-notes+get-75765@lists.php.net to get a copy of this message
Just thought I would point out a bug in PHP Version 4.3.8 using strtotime "+1 month". It seems to have a problem on the 31st of the month. It returns the next month after what you would expect. So +1 month of August is October, +1 month of October is December etc. You can try this code out to see the bug: <?php $timestamp = mktime(20,30,0,10,31,2004); echo date('l, F jS, Y \a\t H:i', $timestamp) . "<br>\n"; $next_month_timestamp = strtotime("+1 month", $timestamp); echo date('l, F jS, Y \a\t H:i', $next_month_timestamp); ?> Cheers, Mike ---- Manual Page -- http://www.php.net/manual/en/function.strtotime.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+45270 Delete -- http://master.php.net/manage/user-notes.php?action=delete+45270&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+45270&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#75765) next »