cal_from_jd: getting Calendar from Julian day Number

Convert a Julian Day count back to calendar parts

cal_from_jd() returns an array describing the requested calendar date.

$parts = cal_from_jd(2461298, CAL_GREGORIAN);
echo $parts['monthname'] . ' ' . $parts['day'] . ', ' . $parts['year'];

Current example first; the detailed examples and demos below are retained for additional learning and comparison.

\ = cal_to_jd(CAL_JULIAN,12,4,2013);
print_r(cal_from_jd(\,CAL_JULIAN));
The output is here
Array ( [date] => 12/4/2013 [month] => 12 [day] => 4 [year] => 2013 [dow] => 2 [abbrevdayname] => Tue [dayname] => Tuesday [abbrevmonth] => Dec [monthname] => December )

By using Julian day count ( Integer value ) we can get the calendar details like month , day , day of the week, year etc ( in the form of an array ). Syntax is here.
cal_from_jd(julian_day INT,CAL_GREGORIAN)

Example 1: Converting Julian Day to Gregorian Date

This example demonstrates how to convert a Julian Day Number to a Gregorian calendar date using cal_from_jd().

\ = 2451545;  // Example Julian Day
\ = cal_from_jd(\, CAL_GREGORIAN);
print_r(\);
Output:
Array
(
    [date] => 1/1/2000
    [month] => 1
    [day] => 1
    [year] => 2000
    [dow] => 6
    [abbrevdayname] => Sat
    [dayname] => Saturday
    [abbrevmonth] => Jan
    [monthname] => January
)
1
---

Example 2: Converting Julian Day to Jewish Calendar Date

This example converts a Julian Day Number to the Jewish calendar system using cal_from_jd().

\2451545 = 2451545;  // Example Julian Day
\Array = cal_from_jd(\2451545, CAL_JEWISH);
print_r(\Array);
Output:
Array
(
    [date] => 4/23/5760
    [month] => 4
    [day] => 23
    [year] => 5760
    [dow] => 6
    [abbrevdayname] => Sat
    [dayname] => Saturday
    [abbrevmonth] => Tevet
    [monthname] => Tevet
)
---

Example 3: Converting Julian Day to French Republican Calendar

This example demonstrates converting a Julian Day Number into the French Republican calendar system.

\2451545 = 2375840;  // Example Julian Day
\Array = cal_from_jd(\2451545, CAL_FRENCH);
print_r(\Array);
Output:
Array
(
    [date] => 1/1/1
    [month] => 1
    [day] => 1
    [year] => 1
    [dow] => 6
    [abbrevdayname] => Sat
    [dayname] => Saturday
    [abbrevmonth] => Vendemiaire
    [monthname] => Vendemiaire
)

Demo of how Unix timestamp is used to generate Julian Day and Calendar
Calendar Functions


Subscribe to our YouTube Channel here



plus2net.com











PHP video Tutorials
✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer