w3resource

PHP : cal_to_jd() function

Converts from a supported calendar to Julian Day Count

The cal_to_jd() function calculates the Julian day count for a date in the specified calendar.

Version

(PHP 4 and above)

Syntax

cal_to_jd (calendar, month, day, year) 

Parameters

Name Description Required /
Optional
Type
calendar Supported calendar/values. CAL_GREGORIAN
CAL_JULIAN
CAL_JEWISH
CAL_FRENCH.
Required Integer
month The given month.
The valid range depends on the specified calendar.
Required Integer
day The given day.
The valid range depends on the specified calendar.
Required Integer
year The given year.
The valid range depends on the specified calendar.
Required Integer

Return value:

A Julian Day number.

Value Type: Integer.

Example:


<?php
$cal_date = cal_to_jd(CAL_GREGORIAN,11,04,2006);
echo($cal_date);
?>

Output:

2454044 

View the example in the browser

See also

PHP Function Reference



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/php/function-reference/cal_to_jd.php