Computer >> Computer tutorials >  >> Programming >> PHP

cal_from_jd() function in PHP


The cal_from_jd() function returns information about a given calendar.

Syntax

cal_from_jd(julian_day, calendar)

Parameters

  • julian_day − Mention Julian day as integer

  • calendar − The calendar. Possible values are −

    • CAL_GREGORIAN

    • CAL_JULIAN

    • CAL_JEWISH

    • CAL_FRENCH

Return

The cal_from_jd() function returns an array with the following information −

  • date
  • month
  • year
  • day of week

Example

The following is an example −

<?php
$res = unixtojd(mktime(0, 0, 0, 10, 05, 2018));
print_r(cal_from_jd($res, CAL_GREGORIAN));
?>

Output

The following is the output −

Array
(
[date] => 10/5/2018
[month] => 10
[day] => 5
[year] => 2018
[dow] => 5
[abbrevdayname] => Wed
[dayname] => Wednesday
[abbrevmonth] => Oct
[monthname] => October
)