|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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
:)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 29 13:00:01 2025 UTC |
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?