php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30225 date("z") returns a bad date
Submitted: 2004-09-25 00:24 UTC Modified: 2004-10-22 00:22 UTC
From: lywenn at free dot fr Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.0.0 OS: Slackware Linux 10.0
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: lywenn at free dot fr
New email:
PHP Version: OS:

 

 [2004-09-25 00:24 UTC] lywenn at free dot fr
Description:
------------
date("z"); seem to don't add a day in leapyears

today it returns 268 instead of 267 :)

msk@troll msk $ date
sam sep 25 00:15:05 CEST 2004
msk@troll msk $ date +%j
269

Reproduce code:
---------------
date("z");

Expected result:
----------------
msk@troll msk $ date
sam sep 25 00:15:05 CEST 2004
msk@troll msk $ date +%j
269


while php date("z") returns : 268

:)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-22 00:03 UTC] scottm at spamcop dot net
PHP calculates the day of the year from 0-365 as it says in the PHP documentation which is what is presented in the tm struct for tm_yday.

GNU date binary lists this from 1-366.

[root@devbox root]# date +%j -d"1/1/2004"
001

[root@devbox root]# php -r 'echo date("z", mktime(0,0,0,1,1,2004));'
0

Bogus?
 [2004-10-22 00:22 UTC] derick@php.net
Yup, bogus.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Sep 19 15:01:27 2024 UTC