php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51107 date_parse_from_format does not parse after 'O' or 'Z' - format
Submitted: 2010-02-21 19:51 UTC Modified: 2010-04-25 19:57 UTC
From: mail at henkbulder dot nl Assigned: felipe (profile)
Status: Closed Package: Date/time related
PHP Version: 5.3.1 OS: *
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: mail at henkbulder dot nl
New email:
PHP Version: OS:

 

 [2010-02-21 19:51 UTC] mail at henkbulder dot nl
Description:
------------
date_parse_from_format doesn't seem to parse anything after (at the right hand of) a timezone-offset ('O' or 'Z'). 

I shuffled the date-string (and format-strings accordingly) around a few times, and the only way to properly fill the array seems to be putting timezone-offset at the end of the string.

Reproduce code:
---------------
$testdate = "Sat Feb 20 +0000 15:37:44 2010";
$createdarr = date_parse_from_format("D M d O G:i:s Y", $testdate);
print_r($createdarr);


Expected result:
----------------
Array
(
    [year] => 2010
    [month] => 2
    [day] => 20
    [hour] => 15
    [minute] => 37
    [second] => 44
    [fraction] => 
    [warning_count] => 0
    [warnings] => Array
        (
        )

    [error_count] => 0
    [errors] => Array
        (
        )

    [is_localtime] => 1
    [zone_type] => 1
    [zone] => 0
    [is_dst] => 
)


Actual result:
--------------
Array
(
    [year] => 
    [month] => 2
    [day] => 20
    [hour] => 
    [minute] => 
    [second] => 
    [fraction] => 
    [warning_count] => 0
    [warnings] => Array
        (
        )

    [error_count] => 1
    [errors] => Array
        (
            [30] => Data missing
        )

    [is_localtime] => 1
    [zone_type] => 1
    [zone] => 0
    [is_dst] => 
)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-02-21 20:57 UTC] jani@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2010-03-01 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2010-04-25 19:57 UTC] felipe@php.net
-Status: No Feedback +Status: Closed -Assigned To: +Assigned To: felipe
 [2010-04-25 19:57 UTC] felipe@php.net
I can't reproduce it, it looks already fixed.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 14:01:36 2025 UTC