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

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

The count starts from 0..



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

[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.

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

[2003-10-08 05:30:45] australia at bookrealm dot com

Month / days (2003) 
 
Jan: 31 
Feb: 28 
Mar: 31 
Apr: 30 
May: 31 
Jun: 30 
Jul: 31 
Aug: 31 
Sep: 30 
TOTAL: 273 days 
 
Currently 8th of Oct, 2003, thus 
PLUS 8 days (273 + 8). So today is day: 281 
 
Thus, in my humble opinion, mcal_day_of_year() seem 
correct, getdate() seems not to be. But, if getdate() is 
correct, then that makes all the calendars and organizers, 
paper and computer, incorrect when they state Oct 8, 2003, 
as being day '281' and not '280'. 
 
I did "RTFM" as you had suggested. "0-366" just indicates 
the number range, correct? 
 
Cheers, 
Andrew Skripshak

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

[2003-10-08 04:52:20] [EMAIL PROTECTED]

And RTFM: yday == 0-366 days


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

[2003-10-08 04:51:41] [EMAIL PROTECTED]

Day count for this date (2003-10-08) is 280.

e.g. 
# php -r 'echo date("z");'
280

It's propably mcal that is broken. (and I mean the library, not
extension)


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

[2003-10-08 04:21:51] australia at bookrealm dot com

Description:
------------
The array key 'yday' from getdate() is one day less than it 
should be. Bug can be confirmed using mcal_day_of_year(). 
 
 

Reproduce code:
---------------
<?php
$y = date(Y);
$m = date(n);
$d = date(j);
echo mcal_day_of_year($y,$m,$d) . "<br />";

$day_year = getdate();
echo $day_year[yday];
?>

Expected result:
----------------
Example date: 
2003-10-8 
 
Expected result: 
281 
281 

Actual result:
--------------
Example date: 
2003-10-8 
 
Actual result: 
281 
280 


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


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

Reply via email to