Computer >> Computer tutorials >  >> Programming >> PHP

cal_to_jd() function in PHP


The cal_to_jd() function converts a date to Julian day count. It returns a Julian day number.

Syntax

cal_to_jd(calendar, month, day, year)

Parameters

  • calendar − The calendar to convert from. Possible values −

    • CAL_GREGORIAN

    • CAL_JULIAN

    • CAL_JEWISH

    • CAL_FRENCH

  • month  − Set the month as a number.

  • day  − Set the day as a number.

  • year  − Set the year as a number.

Return

The cal_to_jd() function returns a Julian day number.

Example

The following is an example −

<?php
$res = cal_to_jd(CAL_GREGORIAN,10,15,2018);
echo $res;
?>

Output

2458407