PHP gregoriantojd()Functions

PHP Calendar 参考手册PHP Calendar Reference Manual

Examples

Convert a Gregorian date to a Julian Day Count, and then convert it back to a Gregorian date:

<?php
$jd=gregoriantojd(6,20,2007);
echo $jd . "<br>";
echo jdtogregorian($jd);
?>

Run Example »

Definition and Usage

The gregoriantojd() function converts a Gregorian date to a Julian Day Count.

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

Tip:See also the jdtogregorian()function, used to convert a Julian Day Count to a Gregorian 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: Returns the Julian Day number.
PHP Version: 4+


PHP Calendar 参考手册PHP Calendar Reference Manual Other Extensions