PHP GregorianToJD() Function

Example

Convert Gregorian calendar dates to Julian Day count and then convert back to Gregorian calendar dates:

<?php
$jd=gregoriantojd(9,25,2016);
echo $jd . "<br>";
echo jdtogregorian($jd);
?>

Run Example

Definition and Usage

The gregoriantojd() function converts Gregorian calendar dates to Julian Day count.

Note:Although this function can handle dates before 4714 B.C., you should note that the Gregorian calendar was established in 1582, and some countries even later accepted it (Great Britain in 1752, the Soviet Union in 1918, Greece in 1923). Most European countries used the Roman Julian calendar (Common Era) before the Gregorian calendar.

Tip:See also jdtogregorian() Function, used to convert Julian Day count to Gregorian calendar date.

Syntax

gregoriantojd(month,day,year);
Parameter Description
month Required. A number from 1 to 12, specifying the month.
day Required. A number from 1 to 31, specifying the day.
year Required. A number from -4714 (representing 4714 B.C.) to 9999 (representing 9999 A.D.), specifying the year.

Technical Details

Return Value: Return Julian Day Number.
PHP Version: 4+