|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69191 "ordinal week" (not "ordinal weeks") cannot be parsed
Submitted: 2015-03-05 08:56 UTC Modified: 2015-03-06 11:27 UTC
From: ryosuke_i_628 at yahoo dot co dot jp Assigned:
Status: Closed Package: Date/time related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
25 + 13 = ?
Subscribe to this entry?

 [2015-03-05 08:56 UTC] ryosuke_i_628 at yahoo dot co dot jp
"ordinal weeks" can be parsed, but "ordinal week" cannot.
That seems to be tried to parse as timezone name.

Test script:

try {
    $results['first weeks'] = (new \DateTime('first weeks'))->format('Y-m-d');
    $results['first week'] = (new \DateTime('first week'))->format('Y-m-d');
} catch (\Exception $e) {
    $errors[] = $e->getMessage();

print_r(compact('results', 'errors'));

Expected result:
    [results] => Array
            [first weeks] => 2015-03-12
            [first week] => 2015-03-12

[Finished in 0.5s]

Actual result:
    [results] => Array
            [first weeks] => 2015-03-12

    [errors] => Array
            [0] => DateTime::__construct(): Failed to parse time string (first week) at position 0 (f): The timezone could not be found in the database



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-03-06 11:19 UTC] mr dot bipinks at gmail dot com
(new \DateTime('first week'))->format('Y-m-d');

In the above line, DateTime('first week') is it valid statement?? I cant find any keyword like "week" in the relative formats,check here:

instead i found "weeks", that worked so fine.
 [2015-03-06 11:27 UTC] ryosuke_i_628 at yahoo dot co dot jp
-Status: Open +Status: Closed
 [2015-03-06 11:27 UTC] ryosuke_i_628 at yahoo dot co dot jp
I noticed that "week" was the invalid statement after I had submitted this issue. Very sorry.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Mar 04 01:01:29 2024 UTC