[PATCH] Fix for bug #19788

From: Date: Sun, 03 Nov 2002 19:28:33 +0000
Subject: [PATCH] Fix for bug #19788
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-10462@lists.php.net to get a copy of this message
Attached is a fix for bug #19788. This is also a more accurate and quite likely faster implementation of the original code. Ilia P.S. Please cc your replies to me, since I am not subscribed to the list.

Index: Calc.php =================================================================== RCS file: /repository/pear/Date/Date/Calc.php,v retrieving revision 1.2 diff -u -3 -p -r1.2 Calc.php --- Calc.php 18 Sep 2002 14:54:07 -0000 1.2 +++ Calc.php 3 Nov 2002 19:25:17 -0000 @@ -182,22 +182,9 @@ class Date_Calc if(empty($day)) $day = Date_Calc::dateNow("%d"); - if($month > 2) - $month -= 2; - else - { - $month += 10; - $year--; - } - - $day = ( floor((13 * $month - 1) / 5) + - $day + ($year % 100) + - floor(($year % 100) / 4) + - floor(($year / 100) / 4) - 2 * - floor($year / 100) + 77); - - $weekday_number = (($day - 7 * floor($day / 7))); - + $time_s = mktime(0, 0, 0, $month, $day, $year); + $weekday_number = date("W", $time_s); + return $weekday_number; } // end func dayOfWeek
« previous php.pear.dev (#10462) next »