note 110124 added to function.unixtojd
| From: | alexsand3 at gmail dot com | Date: | Fri, 21 Sep 2012 21:22:45 +0000 |
| Subject: | note 110124 added to function.unixtojd | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-190954@lists.php.net to get a copy of this message | ||
<?php
function getJulianDay($time) {
date_default_timezone_set('UTC');
$date = getdate($time);
$frac = $date['mday'] + (($date['hours'] + ($date['minutes'] / 60) +
($date['seconds'] / 60 / 60)) / 24);
if($date['year'] < 1582) $greg = 0;
else $greg = 1;
if(($date['mon'] == 1) || ($date['mon'] == 2)) {
$date['year'] = $date['year'] - 1;
$date['mon'] = $date['mon'] + 12;
}
$a = floor($date['year'] / 100);
$b = (2 - $a + floor($a / 4)) * $greg;
if($date['year'] < 0) $c = floor((365.25 * $date['year']) - 0.75);
else $c = floor(365.25 * $date['year']);
$d = floor(30.6001 * ($date['mon'] + 1));
$jd = $b + $c + $d + 1720994.5;
$jd = $jd + $frac;
return $jd;
}
?>
source http://www.smokycogs.com/blog/astronomical-calculations-in-c-sharp-the-julian-day/
----
Server IP: 69.147.83.199
Probable Submitter: 217.19.214.66
----
Manual Page -- http://www.php.net/manual/en/function.unixtojd.php
Edit -- https://master.php.net/note/edit/110124
Del: integrated -- https://master.php.net/note/delete/110124/integrated
Del: useless -- https://master.php.net/note/delete/110124/useless
Del: bad code -- https://master.php.net/note/delete/110124/bad+code
Del: spam -- https://master.php.net/note/delete/110124/spam
Del: non-english -- https://master.php.net/note/delete/110124/non-english
Del: in docs -- https://master.php.net/note/delete/110124/in+docs
Del: other reasons-- https://master.php.net/note/delete/110124
Reject -- https://master.php.net/note/reject/110124
Search -- https://master.php.net/manage/user-notes.php