ID:               25787
 User updated by:  australia at bookrealm dot com
 Reported By:      australia at bookrealm dot com
-Status:           Bogus
+Status:           Open
 Bug Type:         Date/time related
 Operating System: SuSE Linux 8.2
 PHP Version:      4.3.1
 New Comment:

Ok, I'll work with it the way it is. 
 
However, there are two things, maybe in other places too, 
which need to be changed. The values in "Example returned 
values" for both date("z") and 'yday' in getdate() show 
"0-366", these should be changed to "0-365" (as is shown in 
the 'man 3 localtime' you gave me to look at). Else there 
be 366 days in a normal year, and 367 in a leap year? 
 
I still believe it should be "1-366", but ah well. 
 
Cheers, 
Andrew Skripshak


Previous Comments:
------------------------------------------------------------------------

[2003-10-08 06:43:35] [EMAIL PROTECTED]

I meant localtime, not date:

# man 3 localtime

And look at the tm_yday section.



------------------------------------------------------------------------

[2003-10-08 06:37:47] [EMAIL PROTECTED]

There is no bug and this is how it works in libc provided date() too.


------------------------------------------------------------------------

[2003-10-08 06:27:10] australia at bookrealm dot com

Yes, I figured the count started from zero, but really it 
shouldn't. The 1st of the 1st of any year should be day # 
1, not day # 0. 
 
The manuals state that 'yday' in getdate() and 'z' in 
date() give "The day of the year". This is not correct if 
both are out by one day, and no indication that that is the 
case, and no indication that you must add one day to make 
them correct. 
 
The proper fix would be to fix the code, but a slacker fix 
would be to state in the manuals that you must add a day, 
ie., date("z") + 1, to get the correct "day of the year" 
number. 
 
Up to you, of course, which you choose to do. 
 
Cheers, 
Andrew Skripshak

------------------------------------------------------------------------

[2003-10-08 06:05:45] [EMAIL PROTECTED]

Maybe this clears it for you:
# php -r 'echo date("z", mktime(1,1,1,1,1,2003));'
0

The count starts from 0..


------------------------------------------------------------------------

[2003-10-08 05:56:06] australia at bookrealm dot com

And, IMHO, the example you gave, 
echo date("z"); 
thus also seems to give incorrect results.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/25787

-- 
Edit this bug report at http://bugs.php.net/?id=25787&edit=1

Reply via email to