php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45725 date_create DateTime format('z') returns null
Submitted: 2008-08-05 12:53 UTC Modified: 2008-08-05 13:10 UTC
From: john dot oconnor at landingnet dot co dot uk Assigned:
Status: Closed Package: Date/time related
PHP Version: 5.2.6 OS: Linux
Private report: No CVE-ID: None
 [2008-08-05 12:53 UTC] john dot oconnor at landingnet dot co dot uk
Description:
------------
When using date_create to find out the day of the year for a given date using the date string format 'z', you expect a result from 0-365.

When testing 2008-01-02 you get the expected result 1.
With 2008-01-01 the format returns null, incorrectly.

Reproduce code:
---------------
$date_time = date_create('2008-01-01 00:00:00');
$formatted_time = $date_time->format('z');
var_dump($formatted_time);

Expected result:
----------------
integer of value zero.

Actual result:
--------------
null

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-08-05 13:10 UTC] john dot oconnor at landingnet dot co dot uk
submitted in error
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Jan 21 15:01:23 2021 UTC