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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: pdaugherty at cem dot va dot gov
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Sat May 04 11:01:32 2024 UTC