cal_from_jd
Description
The cal_from_jd of Calendar for PHP converts from Julian Day Count to a supported calendar.
Syntax
cal_from_jd( int $julian_day, int $calendar ): array
Parameters
julian_day
Julian day as integer
calendar
Calendar to convert to
Value | Constant | Description |
---|---|---|
0 | CAL_GREGORIAN | Gregorian Calendar |
1 | CAL_JULIAN | Julian Calendar |
2 | CAL_JEWISH | Jewish Calendar |
3 | CAL_FRENCH | French Revolutionary Calendar |
Return
Returns an array containing calendar information like month, day, year, day of week (dow), abbreviated and full names of weekday and month and the date in string form "month/day/year". The day of week ranges from 0 (Sunday) to 6 (Saturday).
Examples
1 · julian_day calendar · CAL_GREGORIAN
<? $julian_day = unixtojd(); $calendar = CAL_GREGORIAN; $return = cal_from_jd($julian_day, $calendar); print_r($return); ?>
Array ( [date] => 9/20/2024 [month] => 9 [day] => 20 [year] => 2024 [dow] => 5 [abbrevdayname] => Fri [dayname] => Friday [abbrevmonth] => Sep [monthname] => September )
2 · julian_day calendar · CAL_JULIAN
<? $julian_day = unixtojd(); $calendar = CAL_JULIAN; $return = cal_from_jd($julian_day, $calendar); print_r($return); ?>
Array ( [date] => 9/7/2024 [month] => 9 [day] => 7 [year] => 2024 [dow] => 5 [abbrevdayname] => Fri [dayname] => Friday [abbrevmonth] => Sep [monthname] => September )
3 · julian_day calendar · CAL_JEWISH
<? $julian_day = unixtojd(); $calendar = CAL_JEWISH; $return = cal_from_jd($julian_day, $calendar); print_r($return); ?>
Array ( [date] => 13/17/5784 [month] => 13 [day] => 17 [year] => 5784 [dow] => 5 [abbrevdayname] => Fri [dayname] => Friday [abbrevmonth] => Elul [monthname] => Elul )
4 · julian_day calendar · CAL_FRENCH
<? $month = 9; $day = 22; $year = 1806; $julian_day = gregoriantojd($month, $day, $year); $calendar = CAL_FRENCH; $return = cal_from_jd($julian_day, $calendar); print_r($return); ?>
Array ( [date] => 13/5/14 [month] => 13 [day] => 5 [year] => 14 [dow] => 1 [abbrevdayname] => Mon [dayname] => Monday [abbrevmonth] => Extra [monthname] => Extra )