Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP gregoriantojd() Function

PHP gregoriantojd() Function

PHP Calendar Reference Manual PHP Calendar Reference Manual

Example

Convert a Gregorian calendar date to a Julian day count and then back to a Gregorian date:

"; echo jdtogregorian($jd); ?>

Run Example »


Definition and Usage

The gregoriantojd() function converts a Gregorian calendar date to a Julian day count.

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

**Tip:** See the jdtogregorian() function, which converts a Julian day count to a 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+

PHP Calendar Reference Manual PHP Calendar Reference Manual