note 16516 modified in function.gregoriantojd by tomsommer
| From: | tomsommer@php.net | Date: | Fri, 16 Jan 2004 23:50:01 +0000 |
| Subject: | note 16516 modified in function.gregoriantojd by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-63716@lists.php.net to get a copy of this message | ||
Just in case you don't have the calendar functions bound into the PHP you're using,
here's a replacement...
function GregorianToJD ($month,$day,$year) {
if ($month > 2) {
$month = $month - 3;
} else {
$month = $month + 9;
$year = $year - 1;
}
$c = floor($year / 100);
$ya = $year - (100 * $c);
$j = floor((146097 * $c) / 4);
$j += floor((1461 * $ya)/4);
$j += floor(((153 * $month) + 2) / 5);
$j += $day + 1721119;
return $j;
}
--was--
Just in case you don't have the calendar functions bound into the PHP you're using,
here's a replacement...
function GregorianToJD($month, $day, $year)
{
$a = floor((14-$month)/12);
$y = floor($year+4800-$a);
$m = floor($month+12*$a-3);
$jd = $day+floor((153*m+2)/5)+$y*365;
$jd += floor($y/4)-floor($y/100)+floor($y/400)-32045;
return $jd;
}
http://www.php.net/manual/en/function.gregoriantojd.php