cal_from_jd: getting Calendar from Julian day Number

$jdday_number = cal_to_jd(CAL_JULIAN,12,4,2013);
print_r(cal_from_jd($jdday_number,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().

$jd = 2451545;  // Example Julian Day
$date = cal_from_jd($jd, CAL_GREGORIAN);
print_r($date);
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().

$jd = 2451545;  // Example Julian Day
$date = cal_from_jd($jd, CAL_JEWISH);
print_r($date);
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.

$jd = 2375840;  // Example Julian Day
$date = cal_from_jd($jd, CAL_FRENCH);
print_r($date);
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
Subhendu Mohapatra — author at plus2net
Subhendu Mohapatra

Author

🎥 Join me live on YouTube

Passionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.



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-2025   plus2net.com   All rights reserved worldwide Privacy Policy Disclaimer