Julian Dates from Proleptic Gregorian and Julian Calendars

1.4.1 · maintenance · verified Fri Apr 10

jdcal is a Python module designed for converting between Julian dates and calendar dates, supporting both proleptic Gregorian and Julian calendars. It enhances precision by storing Julian dates as a pair of floating-point numbers. The library provides functions for conversions in both directions (e.g., `gcal2jd` for Gregorian to Julian Date, and `jd2gcal` for the reverse). The current version is 1.4.1, with its last update in April 2019, suggesting a maintenance-focused release cadence.

Warnings

Install

Imports

Quickstart

This example demonstrates how to convert a Gregorian date to a Julian date using `gcal2jd` and then convert it back to a Gregorian date using `jd2gcal`.

from jdcal import gcal2jd, jd2gcal

# Convert Gregorian date to Julian date
year, month, day = 2000, 1, 1
jd1, jd2 = gcal2jd(year, month, day)
print(f"Gregorian {year}-{month}-{day} is Julian Date: {jd1} + {jd2} = {jd1 + jd2}")

# Convert Julian date back to Gregorian date
g_year, g_month, g_day, g_fraction = jd2gcal(jd1, jd2)
print(f"Julian Date {jd1} + {jd2} converts to Gregorian: {g_year}-{g_month}-{g_day} (fraction: {g_fraction})")

view raw JSON →