PHP GregorianToJD() Function

Example

Convert Gregorian calendar dates to Julian Day count and then 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., please note that the Gregorian calendar was established in 1582, and some countries even adopted it later (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);
Parameters 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: Returns the Julian Day number.
PHP Version: 4+