PHP cal_from_jd() Function
This article is part of the , where you not only learn technology but also your dreams!
PHP cal_from_jd() Function
The cal_from_jd() function in PHP converts a Julian Day Number (JDN) to a calendar date.
Syntax
array cal_from_jd ( int $jd , int $calendar )
Parameters
- jd
- The Julian Day Number.
- calendar
- The type of calendar. This can be one of the following constants:
CAL_GREGORIAN- Gregorian calendarCAL_JULIAN- Julian calendarCAL_JEWISH- Jewish calendarCAL_FRENCH- French Revolutionary calendarCAL_HEBREW- Hebrew calendarCAL_ISO8601- ISO 8601 calendarCAL_PERSIAN- Persian calendarCAL_THAI- Thai Buddhist calendarCAL_ROOMANIAN- Romanian calendarCAL_HIJRI- Hijri calendar
Returns
An associative array containing the year, month, day, and other information about the given Julian Day Number in the specified calendar.
Example
<?php
$jd = gregoriantojd(2023, 10, 1);
print_r(cal_from_jd($jd, CAL_GREGORIAN));
?>
Output:
Array
(
=> 2023
=> 10
=> 1
=> 1
=> 1
=> October
=> 1
=> 2023
)
YouTip