lsolesen\pel\PelEntryTime::convertGregorianToJd PHP Method

convertGregorianToJd() public method

Converts a date in year/month/day format to a Julian Day count.
public convertGregorianToJd ( integer $year, integer $month, integer $day ) : integer
$year integer the year.
$month integer the month, 1 to 12.
$day integer the day in the month.
return integer the Julian Day count.
    public function convertGregorianToJd($year, $month, $day)
    {
        // Special case mapping 0/0/0 -> 0
        if ($year == 0 || $month == 0 || $day == 0) {
            return 0;
        }
        $m1412 = $month <= 2 ? -1 : 0;
        return floor(1461 * ($year + 4800 + $m1412) / 4) + floor(367 * ($month - 2 - 12 * $m1412) / 12) - floor(3 * floor(($year + 4900 + $m1412) / 100) / 4) + $day - 32075;
    }