note 51040 modified in function.gregoriantojd by danbrown
| From: | danbrown@php.net | Date: | Sun, 20 Jul 2008 01:59:11 +0000 |
| Subject: | note 51040 modified in function.gregoriantojd by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-141931@lists.php.net to get a copy of this message | ||
You can obtain the decimal fraction of the Julian date with the php gregoriantojd() function or the
function shown below by applying this code to the returned value.
<?php
$julianDate = gregoriantojd($month, $day, $year);
//correct for half-day offset
$dayfrac = date('G') / 24 - .5;
if ($dayfrac < 0) $dayfrac += 1;
//now set the fraction of a day
$frac = $dayfrac + (date('i') + date('s') / 60) / 60 / 24;
$julianDate = $julianDate + $frac;
?>
--was--
You can obtain the decimal fraction of the Julian date with the php gregoriantojd() function or the
function shown below by applying this code to the returned value.
$julianDate = gregoriantojd($month, $day, $year);
//correct for half-day offset
$dayfrac = date('G') / 24 - .5;
if ($dayfrac < 0) $dayfrac += 1;
//now set the fraction of a day
$frac = $dayfrac + (date('i') + date('s') / 60) / 60 / 24;
$julianDate = $julianDate + $frac;
http://php.net/manual/en/function.gregoriantojd.php