php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18779 Date("yz") returns wrong julian date
Submitted: 2002-08-07 08:16 UTC Modified: 2002-08-07 09:30 UTC
From: pdaugherty at cem dot va dot gov Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.2.1 OS: Redhat Linux 7.3 Kernel 2.4.18-5
Private report: No CVE-ID: None
 [2002-08-07 08:16 UTC] pdaugherty at cem dot va dot gov
Date("yz") returns wrong julian date. 

For 8/7/02, php funcion 'date("yz")' returns 02218, which is wrong.  Php function 'date("d-M-Y") returns 07-Aug-2002, which is correct. The shell command "date +%j" returns the proper julian date of 219. 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-07 08:19 UTC] pdaugherty at cem dot va dot gov
edit spelling
 [2002-08-07 09:12 UTC] georg@php.net
The result from date("yz") is ok: y=02, and z=218. z is the day of the year from 0..365 (as described in the documentation).

 [2002-08-07 09:21 UTC] pdaugherty at cem dot va dot gov
But the actual day of the year on August 7th 2002 is 219 not 218. The format is ok, but the date calculation is wrong.
 [2002-08-07 09:30 UTC] eru@php.net
Which is totally correct, because the range of days is from 0 to 365. From the manual:
z - day of the year; i.e. "0" to "365"

date( "z", mktime( 0, 0, 0, 1, 1, 2002 ) );

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 03:01:35 2025 UTC