#30225 [Com]: date("z") returns a bad date
| From: | scottm at spamcop dot net | Date: | Thu, 21 Oct 2004 22:03:07 +0000 |
| Subject: | #30225 [Com]: date("z") returns a bad date | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-67923@lists.php.net to get a copy of this message | ||
ID: 30225
Comment by: scottm at spamcop dot net
Reported By: lywenn at free dot fr
Status: Open
Bug Type: Date/time related
Operating System: Slackware Linux 10.0
PHP Version: 5.0.0
New Comment:
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?
Previous Comments:
------------------------------------------------------------------------
[2004-09-25 00:24:27] 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
:)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30225&edit=1