cal_to_jd

Converts from a supported calendar to Julian Day Count

Syntax

cal_to_jd(int $calendar, int $month, int $day, int $year) : int

Parameters

calendar

Calendar to convert from

Number Constant Description
0 CAL_GREGORIAN Gregorian Calendar
1 CAL_JULIAN Julian Calendar
2 CAL_JEWISH Jewish Calendar
3 CAL_FRENCH French Revolutionary Calendar
month

The month as a number, the valid range depends on the calendar

day

The day as a number, the valid range depends on the calendar

year

The year as a number, the valid range depends on the calendar

Return

A Julian Day number.

Examples

calendar | CAL_GREGORIAN

<?

$calendar = CAL_GREGORIAN;
$month = 1;
$day = 1;
$year = 1;

$return = cal_to_jd($calendar, $month, $day, $year);

echo $return;

?>
1721426

calendar | CAL_JULIAN

<?

$calendar = CAL_JULIAN;
$month = 1;
$day = 1;
$year = 1;

$return = cal_to_jd($calendar, $month, $day, $year);

echo $return;

?>
1721424

calendar | CAL_JEWISH

<?

$calendar = CAL_JEWISH;
$month = 1;
$day = 1;
$year = 1;

$return = cal_to_jd($calendar, $month, $day, $year);

echo $return;

?>
347998

calendar | CAL_FRENCH

<?

$calendar = CAL_FRENCH;
$month = 1;
$day = 1;
$year = 1;

$return = cal_to_jd($calendar, $month, $day, $year);

echo $return;

?>
2375840

PHP

Home Menu