PHP Tutorial - PHP cal_to_jd() Function






Definition

The cal_to_jd() function converts a date in a specified calendar to Julian Day Count.

Syntax

PHP cal_to_jd() Function has the following syntax.

cal_to_jd(calendar,month,day,year);

Parameter

ParameterIs RequiredDescription
calendarRequired.Calendar to convert from.
monthRequired.Month as a number
dayRequired.Day as a number
yearRequired.Year as a number

calendar must be one of the following values:

  • CAL_GREGORIAN
  • CAL_JULIAN
  • CAL_JEWISH
  • CAL_FRENCH




Return

PHP cal_to_jd() Function returns a Julian Day number.

Example

Convert 20th of June, 2013 (Gregorian calendar) to Julian Day Count:


<?php
$d=cal_to_jd(CAL_GREGORIAN,6,20,2013);
echo $d;
?>

The code above generates the following result.