|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #51472 DateTime::createFromFormat() does not accept 'W' or 'w' format specifier
Submitted: 2010-04-04 18:30 UTC Modified: 2022-05-13 10:35 UTC
Avg. Score:3.0 ± 0.0
Reproduced:4 of 4 (100.0%)
Same Version:1 (25.0%)
Same OS:0 (0.0%)
From: wmbr at cust dot in Assigned: derick (profile)
Status: Wont fix Package: Date/time related
PHP Version: 5.3.2 OS: ubuntu
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2010-04-04 18:30 UTC] wmbr at cust dot in
Although the documentation claims every "Format accepted by date()" is accepted by DateTime::createFromFormat() (, the specifiers 'W' and 'w' are actually not.
So this is either a bug or a documentation-error.

Test script:
$mydate = DateTime::createFromFormat('W', '1');


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-04-04 23:47 UTC]
-Package: Date/time related +Package: Documentation problem
 [2010-04-17 15:13 UTC]
-Package: Documentation problem +Package: Date/time related -Assigned To: +Assigned To: derick
 [2011-05-03 10:02 UTC] sjaillet at gmail dot com
This missing feature (of w at least) requires parsing the english textual representation of days for localizing it. Obtaining an index would be much more efficient !
 [2017-02-12 20:40 UTC]
-Type: Bug +Type: Feature/Change Request
 [2022-05-13 10:35 UTC]
-Status: Assigned +Status: Wont fix
 [2022-05-13 10:35 UTC]
I am marking this as "Won't Fix". If this is still an issue, please open a new ticket at

The documentation has been updated (a long time ago) to say:
In most cases, the same letters as for the date() can be used.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Sep 28 10:03:42 2022 UTC