public static function jdDayOfWeek($julian_day, $mode)
    {
        $day_of_week = ($julian_day + 1) % 7;
        if ($day_of_week < 0) {
            $day_of_week += 7;
        }

        switch ($mode) {
            case 1: // 1, not CAL_DOW_LONG - see bug 67960
                return self::$DAY_NAMES[$day_of_week];

            case 2: // 2, not CAL_DOW_SHORT - see bug 67960
                return self::$DAY_NAMES_SHORT[$day_of_week];

            default: // CAL_DOW_DAYNO or anything else
                return $day_of_week;
        }
    }