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
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: john dot oconnor at landingnet dot co dot uk
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 13:01:28 2025 UTC