|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55046 strtotime ->wrong results with "first wednesday june 2011"
Submitted: 2011-06-13 16:30 UTC Modified: 2011-06-13 16:54 UTC
From: privat at thomasruecker dot at Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.2.17 OS: Linux
Private report: No CVE-ID: None
 [2011-06-13 16:30 UTC] privat at thomasruecker dot at
$timestr="first wednesday june 2011";
echo date("d.m.Y",strtotime($timestr));

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:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-06-13 16:33 UTC] 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:54 UTC]
-Status: Open +Status: Bogus
 [2011-06-13 16:54 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

Your string is relative to the current date. You need to add the word 'of' to get 
the first Wednesday of a given month.

PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC