php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #51376 date_parse_from_format no leading zero
Submitted: 2010-03-24 09:41 UTC Modified: 2010-03-24 18:16 UTC
From: george at shoutbomb dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.3.2 OS: Windows
Private report: No CVE-ID: None
 [2010-03-24 09:41 UTC] george at shoutbomb dot com
Description:
------------
date_parse_from_format("Ymd","20100323") returns... no leading zero in the month

Test script:
---------------
<?php
print_r(date_parse_from_format("Ymd","20100323"));
?>

Expected result:
----------------
Array
(
    [year] => 2010
    [month] => 03
    [day] => 23
    [hour] => 
    [minute] => 
    [second] => 
    [fraction] => 
    [warning_count] => 0
    [warnings] => Array
        (
        )

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

    [is_localtime] => 
)

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

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

    [is_localtime] => 
)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-03-24 10:01 UTC] derick@php.net
-Status: Open +Status: Bogus
 [2010-03-24 10:01 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

They are parsed and stored as integers, not as strings.
 [2010-03-24 18:16 UTC] george at shoutbomb dot com
-Type: Bug +Type: Documentation Problem
 [2010-03-24 18:16 UTC] george at shoutbomb dot com
I re-read http://us.php.net/manual/en/function.date-parse-from-format.php and 
there is no mention of parsing as 'integer'.  If the function is accepting the 
"Format accepted by date() with some extras" that it should obey the formatting.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 01:01:30 2024 UTC