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:
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 Previous Comments: ------------------------------------------------------------------------ [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