#23211 [Bgs->Opn]: April First Week strtotime day off error

From: Date: Tue, 22 Apr 2003 16:52:56 +0000
Subject: #23211 [Bgs->Opn]: April First Week strtotime day off error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-38073@lists.php.net to get a copy of this message
ID: 23211 User updated by: jmalan at ocurrance dot com Reported By: jmalan at ocurrance dot com -Status: Bogus +Status: Open Bug Type: Calendar related Operating System: Linux 7 PHP Version: 4.3.1 New Comment: I tried using a timezone and that did not make any difference. Previous Comments: ------------------------------------------------------------------------ [2003-04-22 11:50:17] jmalan at ocurrance dot com I looked at the GNU link on the strtotime page and it states: 1 year 1 year ago 3 years 2 days In the examples for php it states: 1 day 1 week next Thursday last Monday The syntax is completely different in PHP than GNU: Date Input Formats. Which brings me back to my original statement, there is a bug in PHP that interprets "last saturday" (saturday as an example, any day breaks) incorrectly when daylight savings time is in effect. ------------------------------------------------------------------------ [2003-04-22 11:17:38] rasmus@php.net There is a link to the format docs on the strtotime manual page. strtotime() is not a PHP thing, it is a standard library used all over the place. ------------------------------------------------------------------------ [2003-04-22 10:10:18] jmalan at ocurrance dot com Maybe that should be stated in the documentation in the strtotime area so developers know to add that. What would the syntax be if you were doing last saturday? ------------------------------------------------------------------------ [2003-04-22 01:30:26] rasmus@php.net If you specify the timezone at the end of your strtotime string it should work just fine. ------------------------------------------------------------------------ [2003-04-14 16:24:36] jmalan at ocurrance dot com Found a better fix. Instead of using strtotime("last saturday"), try this: date("m/d/Y H:i:s",strtotime("-1 week saturday")); The timechange didn't seem to have any affect to strtotime this way. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/23211 -- Edit this bug report at http://bugs.php.net/?id=23211&edit=1

« previous php.bugs (#38073) next »