php8.5
Home/ Manual/ calendar / functions/ cal_from_jd

cal_from_jd

PHP function Edit on GitHub ✎

(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)

Converts from Julian Day Count to a supported calendar

Description

cal_from_jd(int $julian_day, int $calendar): array

cal_from_jd() converts the Julian day given in julian_day into a date of the specified calendar. Supported calendar values are CAL_GREGORIAN, CAL_JULIAN, CAL_JEWISH and CAL_FRENCH.

Parameters

julian_day

Julian day as integer

calendar

Calendar to convert to

Return Values

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

cal_from_jd() example

php
<?php
$today = unixtojd(mktime(0, 0, 0, 8, 16, 2003));
print_r(cal_from_jd($today, CAL_GREGORIAN));
?>

The above example will output:

output
Array
(
    [date] => 8/16/2003
    [month] => 8
    [day] => 16
    [year] => 2003
    [dow] => 6
    [abbrevdayname] => Sat
    [dayname] => Saturday
    [abbrevmonth] => Aug
    [monthname] => August
)

See Also

Source: reference/calendar/functions/cal-from-jd.xml · from the official PHP manual (php/doc-en)