php.net |  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
Votes:5
Avg. Score:3.0 ± 0.0
Reproduced:5 of 5 (100.0%)
Same Version:1 (20.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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: wmbr at cust dot in
New email:
PHP Version: OS:

 

 [2010-04-04 18:30 UTC] wmbr at cust dot in
Description:
------------
Although the documentation claims every "Format accepted by date()" is accepted by DateTime::createFromFormat() (http://www.php.net/manual/en/datetime.createfromformat.php), 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');
print_r(DateTime::getLastErrors());


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-04-04 23:47 UTC] derick@php.net
-Package: Date/time related +Package: Documentation problem
 [2010-04-17 15:13 UTC] derick@php.net
-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] derick@php.net
-Type: Bug +Type: Feature/Change Request
 [2022-05-13 10:35 UTC] derick@php.net
-Status: Assigned +Status: Wont fix
 [2022-05-13 10:35 UTC] derick@php.net
I am marking this as "Won't Fix". If this is still an issue, please open a new ticket at https://github.com/php/php-src/issues/

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-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 17:01:58 2024 UTC