note 90311 added to function.juliantojd
| From: | YvesSucaet at osu1 dot php dot net | Date: | Wed, 15 Apr 2009 23:23:00 +0000 |
| Subject: | note 90311 added to function.juliantojd | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-153364@lists.php.net to get a copy of this message | ||
Is it possible this function is incorrect? According to Numerical Recipes in Pascal (ISBN
0521375169), 5/23/1968 should have a Julian Date of 2440000. Instead, the value returned by the PHP
function is 2440013. An online converter such as http://www.onlineconversion.com/julian_date.htm
e.g. confirms this. FYI, I ported the NR function to PHP as follows:
function julday($mm, $id, $iyyy) {
$igreg=588829;
if ($iyyy == 0) {
echo 'there is no year zero.';
return null;
}
if ($iyyy < 0) $iyyy = $iyyy+1;
if ($mm > 2) {
$jy = $iyyy;
$jm = $mm+1;
} else {
$jy = $iyyy-1;
$jm = $mm+13;
}
$jul = floor(365.25*$jy)+floor(30.6001*$jm)+$id+1720995;
if ($id+31*($mm+12*$iyyy) >= $igreg) {
$ja = floor(0.01*$jy);
$jul = $jul+2-$ja+floor(0.25*$ja);
}
return $jul;
}
----
Server IP: 208.69.120.35
Probable Submitter: 129.186.148.227
----
Manual Page -- http://www.php.net/manual/en/function.juliantojd.php
Edit -- https://master.php.net/note/edit/90311
Del: integrated -- https://master.php.net/note/delete/90311/integrated
Del: useless -- https://master.php.net/note/delete/90311/useless
Del: bad code -- https://master.php.net/note/delete/90311/bad+code
Del: spam -- https://master.php.net/note/delete/90311/spam
Del: non-english -- https://master.php.net/note/delete/90311/non-english
Del: in docs -- https://master.php.net/note/delete/90311/in+docs
Del: other reasons-- https://master.php.net/note/delete/90311
Reject -- https://master.php.net/note/reject/90311
Search -- https://master.php.net/manage/user-notes.php