Bug #55046 [Opn->Bgs]: strtotime ->wrong results with "first wednesday june 2011"
| From: | dtajchreber@php.net | Date: | Mon, 13 Jun 2011 14:54:31 +0000 |
| Subject: | Bug #55046 [Opn->Bgs]: strtotime ->wrong results with "first wednesday june 2011" | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-161370@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=55046&edit=1
ID: 55046
Updated by: dtajchreber@php.net
Reported by: privat at thomasruecker dot at
Summary: strtotime ->wrong results with "first wednesday june
2011"
-Status: Open
+Status: Bogus
Type: Bug
Package: Date/time related
Operating System: Linux
PHP Version: 5.2.17
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Your string is relative to the current date. You need to add the word 'of' to get
the first Wednesday of a given month.
[1] http://codepad.viper-7.com/qP9XIc
[2] http://www.php.net/manual/en/datetime.formats.relative.php
Previous Comments:
------------------------------------------------------------------------
[2011-06-13 16:33:41] privat at thomasruecker dot at
This is always the case with the "number dayofweek month year" syntax, whenever you choose
the "dayofweek" that correlates with the 1st of the month.
for example
If the 1.MM.YYYY is a wednesday, then "first wednesday month YYYY" returns 08.MM.YYYY,
"second wednesday month YYYY" returns 15.MM.YYYY and so on.
------------------------------------------------------------------------
[2011-06-13 16:30:15] privat at thomasruecker dot at
Description:
------------
<code>
$timestr="first wednesday june 2011";
echo date("d.m.Y",strtotime($timestr));
</code>
Then the result is the 08.06.2011, and not the 01.06.2011 as i expected.
This happens whenever the "first" should be the 01.XX.YYYY
Same thing happens with the
"second","third","fourth","fifth".
Test script:
---------------
$timestr="first wednesday june 2011";
echo date("d.m.Y",strtotime($timestr));
Expected result:
----------------
01.06.2011
Actual result:
--------------
08.06.2011
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=55046&edit=1