#41873 [Asn->Bgs]: strtotime produces incorrect output
| From: | derick@php.net | Date: | Thu, 31 Jan 2008 20:30:27 +0000 |
| Subject: | #41873 [Asn->Bgs]: strtotime produces incorrect output | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-121841@lists.php.net to get a copy of this message | ||
ID: 41873
Updated by: derick@php.net
Reported By: kevin at creativeanvil dot com
-Status: Assigned
+Status: Bogus
Bug Type: Date/time related
Operating System: RHEL 4
PHP Version: 5.2.3
Assigned To: derick
New Comment:
There is no bug here.
If you use "2007-11-30 last friday" you get of course the previous
friday, which is 2007-11-23.
Previous Comments:
------------------------------------------------------------------------
[2007-09-04 22:41:14] jani@php.net
Assigned to the ext/date maintainer.
------------------------------------------------------------------------
[2007-09-04 14:01:08] kevin at creativeanvil dot com
Doing this:
<?php
$stamp = strtotime("last Friday", gmmktime(0,0,0,11+1,0,2007));
echo date("m/d/Y", $stamp)."<br>";
$stamp = strtotime("last Friday", gmmktime(0,0,0,8+1,0,2007));
echo date("m/d/Y", $stamp);
?>
Expected Value:
11/30/2007
08/31/2007
Actual Value
11/23/2007
08/24/2007
That should make more sense.
Again this seems to happen when the last day of the month is the last
Friday that we're looking for, then it returns the previous Friday.
------------------------------------------------------------------------
[2007-07-04 11:23:18] tony2001@php.net
So how to reproduce it?
------------------------------------------------------------------------
[2007-07-03 19:30:53] kevin at creativeanvil dot com
Yes, most of the time it is correct, but I've found if the day wanted
is the last day of the month, it may not work correctly. Friday was an
example, it probably has nothing to do with Friday specifically, that's
just what I tested and found the problem.
------------------------------------------------------------------------
[2007-07-03 06:44:47] tony2001@php.net
Works perfectly fine here:
10/26/2007
07/27/2007
------------------------------------------------------------------------
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/41873
--
Edit this bug report at http://bugs.php.net/?id=41873&edit=1