Ejemplo n.º 1
0
 /**
  * Compute the julian day number of the given year.
  * 
  * @param      bool   If true, using Gregorian calendar, otherwise using 
  *                    Julian calendar.
  * @param      int    The given year.
  * @param      bool   True if the year is a leap year.
  * 
  * @return     double 
  * 
  * @author     Dominik del Bondio <*****@*****.**>
  * @author     The ICU Project
  * @since      0.11.0
  */
 private static function computeJulianDayOfYear($isGregorian, $year, &$isLeap)
 {
     $isLeap = $year % 4 == 0;
     $y = $year - 1;
     $julianDay = 365.0 * $y + floor($y / 4) + (AgaviDateDefinitions::JAN_1_1_JULIAN_DAY - 3);
     if ($isGregorian) {
         $isLeap = $isLeap && ($year % 100 != 0 || $year % 400 == 0);
         // Add 2 because Gregorian calendar starts 2 days after Julian calendar
         $julianDay += AgaviCalendarGrego::gregorianShift($year);
     }
     return $julianDay;
 }