cal_from_jd

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

Number 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] => 2/5/2023
    [month] => 2
    [day] => 5
    [year] => 2023
    [dow] => 0
    [abbrevdayname] => Sun
    [dayname] => Sunday
    [abbrevmonth] => Feb
    [monthname] => February
)

2 · julian_day calendar · CAL_JULIAN

<?

$julian_day = unixtojd();
$calendar = CAL_JULIAN;

$return = cal_from_jd($julian_day, $calendar);

print_r($return);

?>
Array
(
    [date] => 1/23/2023
    [month] => 1
    [day] => 23
    [year] => 2023
    [dow] => 0
    [abbrevdayname] => Sun
    [dayname] => Sunday
    [abbrevmonth] => Jan
    [monthname] => January
)

3 · julian_day calendar · CAL_JEWISH

<?

$julian_day = unixtojd();
$calendar = CAL_JEWISH;

$return = cal_from_jd($julian_day, $calendar);

print_r($return);

?>
Array
(
    [date] => 5/14/5783
    [month] => 5
    [day] => 14
    [year] => 5783
    [dow] => 0
    [abbrevdayname] => Sun
    [dayname] => Sunday
    [abbrevmonth] => Shevat
    [monthname] => Shevat
)

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
)

cal_days_in_month

cal_info

cal_to_jd

easter_date

easter_days

frenchtojd

gregoriantojd

jddayofweek

jdmonthname

jdtofrench

jdtogregorian

jdtojewish

jdtojulian

jdtounix

jewishtojd

juliantojd

unixtojd

PHP

Home Menu