Gregorian Calendar

Solar

The Gregorian calendar is the internationally accepted civil calendar, introduced by Pope Gregory XIII on 15 October 1582 as a reform of the Julian calendar.

The reform corrected the accumulated drift of approximately 10 days that had built up since the Council of Nicaea (325 CE), and refined the leap year rule to prevent future drift. A year is a leap year if divisible by 4, unless it is also divisible by 100 — except when divisible by 400. This gives a mean year length of 365.2425 days, very close to the tropical year of ~365.2422 days.

Catholic countries adopted the reform in 1582, but Protestant and Orthodox nations followed much later: the British Empire in 1752, Russia in 1918, Greece in 1923, and Turkey in 1926. Dates before a country's adoption are often given in the Julian calendar ("Old Style").

Formula

January and February are treated as months 13 and 14 of the preceding year:

$$M \le 2 \implies Y\prime = Y - 1,\; M\prime = M + 12$$

The Gregorian correction compensates for the over-counting of leap years in centuries not divisible by 400:

$$A = \left\lfloor \frac{Y\prime}{100} \right\rfloor \qquad B = 2 - A + \left\lfloor \frac{A}{4} \right\rfloor$$

The full conversion to Julian Day Number:

$$\mathrm{JD} = \left\lfloor 365.25\,(Y\prime\!+4716) \right\rfloor + \left\lfloor 30.6001\,(M\prime\!+1) \right\rfloor + D + B - 1524.5$$

The constant 4716 shifts the year into the Julian Period; 30.6001 approximates the irregular month lengths; 1524.5 adjusts the epoch.

def gregorian_to_jd(Y, M, D):
    if M <= 2:
        Y, M = Y - 1, M + 12
    A = Y // 100
    B = 2 - A + A // 4
    return int(365.25 * (Y + 4716)) + int(30.6001 * (M + 1)) + D + B - 1524.5

Algorithm source

Twelve months of 28–31 days: January (31), February (28/29), March (31), April (30), May (31), June (30), July (31), August (31), September (30), October (31), November (30), December (31).

Julian Calendar

Solar

The Julian calendar was introduced by Julius Caesar in 46 BCE, effective from 1 January 45 BCE, replacing the earlier Roman calendar. It was the predominant calendar in Europe and the Mediterranean world for over 1,600 years.

The Julian calendar established a simple leap year rule: every year divisible by 4 is a leap year, giving a mean year of exactly 365.25 days. This is about 11 minutes longer than the tropical year, leading to an accumulated error of approximately 1 day every 128 years.

By the 16th century, the calendar had drifted about 10 days from the astronomical equinox, prompting the Gregorian reform. The Julian calendar is still used liturgically by some Eastern Orthodox churches (the "Old Calendar"), and it remains the standard for historical dating before 15 October 1582.

Formula

Same structure as Gregorian, but with no century correction ($B = 0$). Every 4th year is a leap year without exception, giving a mean year of exactly 365.25 days.

$$M \le 2 \implies Y\prime = Y - 1,\; M\prime = M + 12$$

$$\mathrm{JD} = \left\lfloor 365.25\,(Y\prime\!+4716) \right\rfloor + \left\lfloor 30.6001\,(M\prime\!+1) \right\rfloor + D - 1524.5$$

def julian_to_jd(Y, M, D):
    if M <= 2:
        Y, M = Y - 1, M + 12
    return int(365.25 * (Y + 4716)) + int(30.6001 * (M + 1)) + D - 1524.5

Algorithm source

Twelve months identical in name and length to the Gregorian calendar, differing only in the leap year rule (every 4th year, without exception).

Hijri Calendar (Lunar Islamic)

Lunar

The Hijri calendar (at-taqwim al-hijri) is a purely lunar calendar of 12 months used throughout the Islamic world for religious observances. Its epoch is the Hijra (emigration) of the Prophet Muhammad from Mecca to Medina.

Each month begins, in principle, with the sighting of the new crescent moon. The calendar alternates months of 30 and 29 days, with a leap day added to the last month (Dhu al-Hijja) in certain years. The year is approximately 354 days long (355 in leap years), making it about 11 days shorter than the solar year. The calendar therefore cycles through the seasons over a period of roughly 33 years.

The tabular (arithmetic) version of the Hijri calendar — used in kalkal — employs a fixed 30-year cycle in which 11 years are leap years. Four main variants exist, differing only in which years of the cycle are designated as leap:

The default variant is Wüstenfeld (IIc), the historiographic standard widely adopted in Western scholarship. The East Islamic civil variant (IIa), used in the Mashriq and by the "Kuwaiti algorithm," differs from it in a single leap year (year 18 instead of 19). The West Islamic civil variant (IIIa), used historically in the Maghrib and al-Andalus, shifts three leap years. The fourth variant is attributed to the 9th-century astronomer Ḥabash al-Ḥāsib (IVa).

Formula

The tabular Hijri calendar uses a fixed 30-year cycle in which 11 years are leap (355 days) and 19 are common (354 days). The epoch is 16 July 622 CE (Julian).

$L(N)$ counts how many leap years have occurred up to year $N$:

$$L(N) = \left\lfloor \frac{N}{30} \right\rfloor \cdot 11 + \#\{l \in \mathrm{leaps} : l \le N \bmod 30\}$$

The term $\lfloor (M\!-\!1) \cdot 29.5 + 0.99 \rfloor$ accumulates alternating 30/29-day months:

$$\mathrm{JD} = 1\,948\,439.5 + (Y\!-\!1) \cdot 354 + L(Y\!-\!1) + \left\lfloor (M\!-\!1) \cdot 29.5 + 0.99 \right\rfloor + D - 1$$

EPOCH = 1948439.5
LEAPS_IIc = [2, 5, 7, 10, 13, 16, 19, 21, 24, 26, 29]

def leap_count(n, leaps=LEAPS_IIc):
    full, rem = divmod(n, 30)
    return full * 11 + sum(1 for l in leaps if l <= rem)

def hijri_to_jd(Y, M, D, leaps=LEAPS_IIc):
    return (EPOCH + (Y - 1) * 354 + leap_count(Y - 1, leaps)
            + int((M - 1) * 29.5 + 0.99) + D - 1)

Algorithm source

Twelve months: Muharram (30), Safar (29), Rabi' al-Awwal (30), Rabi' ath-Thani (29), Jumada al-Ula (30), Jumada al-Akhira (29), Rajab (30), Sha'ban (29), Ramadan (30), Shawwal (29), Dhu al-Qa'da (30), Dhu al-Hijja (29 or 30).

Solar Hijri Calendar (Iranian)

Solar

The Solar Hijri calendar is the official calendar of Iran and Afghanistan. It is a solar calendar whose epoch coincides with the Hijra, but whose year length tracks the tropical year via the vernal equinox.

The first six months have 31 days, the next five have 30 days, and the twelfth month (Esfand) has 29 days in common years and 30 in leap years. Officially, the new year (Nowruz) begins at the astronomical vernal equinox as observed from Tehran.

For computational purposes, kalkal uses the arithmetic approximation based on a 2820-year cycle (containing exactly 1,029,983 days), which closely matches the astronomical calendar.

Formula

The arithmetic Solar Hijri uses a 2820-year grand cycle containing exactly 1,029,983 days (683 leap years). The year is normalised to a base year within this cycle:

$$e_b = Y - 474 \qquad e_y = 474 + \bigl((e_b \bmod 2820) + 2820\bigr) \bmod 2820$$

The leap year test uses a modular condition on $e_y$:

$$(e_y \cdot 682 - 110) \bmod 2816 < 682 \implies \text{leap}$$

Month offset $m_{\text{off}}$: months 1–6 have 31 days, 7–11 have 30 days. The full JD:

$$\mathrm{JD} = D + m_{\text{off}} + \left\lfloor \frac{e_y \cdot 682 - 110}{2816} \right\rfloor + (e_y\!-\!1) \cdot 365 + \left\lfloor \frac{e_b}{2820} \right\rfloor \!\cdot\! 1\,029\,983 + 1\,948\,320.5 - 1$$

EPOCH = 1948320.5

def solar_hijri_to_jd(Y, M, D):
    epbase = Y - 474
    epyear = 474 + ((epbase % 2820) + 2820) % 2820
    m_off = (M - 1) * 31 if M <= 7 else (M - 1) * 30 + 6
    return (D + m_off + (epyear * 682 - 110) // 2816
            + (epyear - 1) * 365
            + epbase // 2820 * 1029983 + EPOCH - 1)

def is_leap(Y):
    epbase = Y - 474
    epyear = 474 + ((epbase % 2820) + 2820) % 2820
    return (epyear * 682 - 110) % 2816 < 682

Algorithm source

Twelve months: Farvardin (31), Ordibehesht (31), Khordad (31), Tir (31), Mordad (31), Shahrivar (31), Mehr (30), Aban (30), Azar (30), Dey (30), Bahman (30), Esfand (29/30).

Coptic Calendar

Solar

The Coptic calendar (also called the Alexandrian calendar) descends from the ancient Egyptian civil calendar, reformed under Augustus to include a leap year. It counts years from the Era of the Martyrs (Anno Martyrum, AM).

The calendar consists of 12 months of 30 days each, followed by a short 13th month (Epagomenai) of 5 days in common years or 6 in leap years. Leap years occur every 4 years, when the year number leaves a remainder of 3 when divided by 4.

The Coptic calendar is used liturgically by the Coptic Orthodox Church and for agricultural purposes in Egypt. The Ethiopian calendar shares its structure but uses a different epoch.

Formula

Twelve months of 30 days plus a 13th epagomenal month (5 or 6 days). Leap year every 4 years when $Y \bmod 4 = 3$. Epoch: 29 August 284 CE (Julian).

$$\mathrm{JD} = 1\,825\,029.5 - 1 + 365\,(Y\!-\!1) + \left\lfloor \frac{Y}{4} \right\rfloor + 30\,(M\!-\!1) + D$$

The $\lfloor Y/4 \rfloor$ term adds one leap day every 4th year. The $30(M-1)$ works because all 12 regular months have exactly 30 days.

EPOCH = 1825029.5

def coptic_to_jd(Y, M, D):
    return EPOCH - 1 + 365 * (Y - 1) + Y // 4 + 30 * (M - 1) + D

def jd_to_coptic(jd):
    Y = (4 * (int(jd + 0.5) - EPOCH) + 1463) // 1461
    doy = int(jd + 0.5) - coptic_to_jd(Y, 1, 1)
    M = doy // 30 + 1
    D = doy - (M - 1) * 30 + 1
    return Y, M, D

Algorithm source

Thirteen months: Thout, Paopi, Hathor, Koiak, Tobi, Meshir, Paremhat, Parmouti, Pashons, Paoni, Epip, Mesori (each 30 days), Epagomenai (5 or 6 days).

Ethiopian Calendar

Solar

The Ethiopian calendar is the official calendar of Ethiopia. It belongs to the same Alexandrian family as the Coptic calendar, sharing its structure of 12 × 30-day months plus a 13th epagomenal month.

The epoch is approximately 7–8 years behind the Gregorian calendar. Leap years follow the same rule as the Coptic calendar (year % 4 === 3). The Ethiopian New Year (Enkutatash) falls on 11 September in the Gregorian calendar.

Ethiopia is one of the few countries to use a non-Gregorian calendar as its official civil calendar. The calendar is deeply embedded in Ethiopian culture, religion, and daily life.

Formula

Identical structure to the Coptic calendar (12 × 30 + epagomenal month, same leap rule), but with a different epoch: 29 August 8 CE (Julian).

$$\mathrm{JD} = 1\,724\,220.5 - 1 + 365\,(Y\!-\!1) + \left\lfloor \frac{Y}{4} \right\rfloor + 30\,(M\!-\!1) + D$$

EPOCH = 1724220.5

def ethiopian_to_jd(Y, M, D):
    return EPOCH - 1 + 365 * (Y - 1) + Y // 4 + 30 * (M - 1) + D

def jd_to_ethiopian(jd):
    Y = (4 * (int(jd + 0.5) - EPOCH) + 1463) // 1461
    doy = int(jd + 0.5) - ethiopian_to_jd(Y, 1, 1)
    M = doy // 30 + 1
    D = doy - (M - 1) * 30 + 1
    return Y, M, D

Algorithm source

Thirteen months: Mäskäräm, Ṭəqəmt, Ḥədar, Taḫšaš, Ṭər, Yäkatit, Mägabit, Miyazya, Gənbot, Säne, Ḥamle, Nähase (each 30 days), Pagumän (5 or 6 days).

Zoroastrian Calendar

Solar (wandering)

The Yazdgerdi calendar is the traditional Zoroastrian calendar of Iran, named after Yazdegerd III, the last Sasanian emperor. Its epoch is his coronation in 632 CE.

The calendar consists of 12 months of 30 days each, followed by 5 epagomenal days (the Gatha days). Crucially, it has no leap year mechanism — the year is always exactly 365 days. This makes it a "wandering" calendar that drifts through the seasons.

Shahenshahi was the standard reckoning in Iran and among Zoroastrians. Qadimi is used by Parsi communities in India. Fasli was reformed in the modern era to stay seasonal.

Shahenshahi: wandering 365-day calendar, the historical default. Qadimi: same structure but 30 days earlier, used by Indian Parsis. Fasli: reformed with leap years (every 4th year), Nawruz fixed near 21 March.

Formula

Three variants exist, differing only in epoch. Shahenshahi and Qadimi have no leap year — every year is exactly 365 days, making the calendar drift through the seasons. Fasli adds a leap day when $Y \bmod 4 = 3$.

$$\mathrm{Epoch_S} = 1\,952\,062.5 \qquad \mathrm{Epoch_Q} = 1\,952\,032.5 \qquad \mathrm{Epoch_F} = 1\,951\,975.5$$

$$\mathrm{JD} = \mathrm{Epoch} - 1 + 365\,(Y\!-\!1) + 30\,(M\!-\!1) + D$$

EPOCH = 1952062.5

def yazdgerdi_to_jd(Y, M, D):
    return EPOCH - 1 + 365 * (Y - 1) + 30 * (M - 1) + D

def jd_to_yazdgerdi(jd):
    days = int(jd + 0.5) - EPOCH
    Y = days // 365 + 1
    doy = int(jd + 0.5) - yazdgerdi_to_jd(Y, 1, 1)
    M = min(13, doy // 30 + 1)
    D = doy - (M - 1) * 30 + 1
    return Y, M, D

Algorithm source

Thirteen months: Farvardin, Ordibehesht, Khordad, Tir, Mordad, Shahrivar, Mehr, Aban, Azar, Dey, Bahman, Esfand (each 30 days), plus 5 epagomenal days.

Armenian Calendar

Solar (wandering)

The traditional Armenian calendar is a fixed 365-day calendar with the same structure as the Egyptian and Yazdgerdi calendars. Its epoch is 11 July 552 CE (Julian).

Like the Yazdgerdi calendar, it consists of 12 months of 30 days plus 5 epagomenal days (Aweleacʼ), with no leap year correction. It is therefore a "wandering" calendar that drifts through the seasons.

The Armenian calendar was used in Armenia and by Armenian communities for historical and religious purposes. It was largely superseded by the Gregorian calendar, but remains important for historical chronology.

Formula

A wandering calendar: 12 × 30 days + 5 epagomenal days, no leap year correction. Drifts one day every ~4 years. Same formula as Egyptian, different epoch (11 July 552 CE Julian).

$$\mathrm{JD} = 1\,922\,867.5 - 1 + 365\,(Y\!-\!1) + 30\,(M\!-\!1) + D$$

EPOCH = 1922867.5

def armenian_to_jd(Y, M, D):
    return EPOCH - 1 + 365 * (Y - 1) + 30 * (M - 1) + D

def jd_to_armenian(jd):
    days = int(jd + 0.5) - EPOCH
    Y = days // 365 + 1
    doy = int(jd + 0.5) - armenian_to_jd(Y, 1, 1)
    M = min(13, doy // 30 + 1)
    D = doy - (M - 1) * 30 + 1
    return Y, M, D

Algorithm source

Thirteen months: Navasard, Hoṙi, Sahmi, Trē, K’aloč, Arac’, Mehekan, Areg, Ahekan, Mareri, Margac’, Hrotic’ (each 30 days), Aweleac’ (5 days).

Egyptian Calendar

Solar (wandering)

The ancient Egyptian civil calendar is one of the oldest known calendar systems. It counts years from the Era of Nabonassar (747 BCE).

Like the Yazdgerdi and Armenian calendars, it consists of 12 months of 30 days plus 5 epagomenal days, with no leap year correction. The year is always exactly 365 days, making it a wandering calendar. It served as the prototype for all later 365-day calendars in the region.

Formula

The prototype of all wandering calendars: 12 × 30 days + 5 epagomenal days, always exactly 365 days. Epoch: 26 February 747 BCE Julian (era of Nabonassar).

$$\mathrm{JD} = 1\,448\,637.5 - 1 + 365\,(Y\!-\!1) + 30\,(M\!-\!1) + D$$

EPOCH = 1448637.5

def egyptian_to_jd(Y, M, D):
    return EPOCH - 1 + 365 * (Y - 1) + 30 * (M - 1) + D

Algorithm source

Thirteen months: Thoth, Phaophi, Athyr, Choiak, Tybi, Mechir, Phamenoth, Pharmuthi, Pachons, Payni, Epiphi, Mesore (each 30 days), Epagomenai (5 days).

Byzantine Calendar

Solar

The Byzantine calendar (Anno Mundi) was the official calendar of the Byzantine Empire and the Eastern Orthodox Church for over a thousand years. It counts years from the calculated creation of the world in 5509 BCE.

The calendar uses Julian calendar mechanics but with a September 1 year start and the Byzantine era offset. Month 1 is September, month 12 is August. Leap years follow the Julian rule applied to the underlying Julian year.

Formula

The Byzantine year starts 1 September. The date is converted to a Julian year and month, then passed to the Julian→JD formula (Meeus, eq. 7.1 with $B = 0$):

$$\text{Sep–Dec:}\; Y_J = Y - 5509,\; M_J = M + 8$$

$$\text{Jan–Aug:}\; Y_J = Y - 5508,\; M_J = M - 4$$

$$\mathrm{JD} = \mathrm{julianToJD}(Y_J,\, M_J,\, D)$$

def byzantine_to_jd(Y, M, D):
    if M <= 4:   # Sep-Dec
        return julian_to_jd(Y - 5509, M + 8, D)
    else:        # Jan-Aug
        return julian_to_jd(Y - 5508, M - 4, D)

Algorithm source

Twelve months from September: September, October, November, December, January, February, March, April, May, June, July, August.

Alexandrian Calendar

Solar

The Alexandrian era (Anno Mundi) is a variant of the creation era used by the Church of Alexandria. It places the creation in 5493 BCE, with the year beginning on March 25 (the Annunciation).

Like the Byzantine calendar, it uses Julian calendar mechanics with an era offset and a shifted year start. Month 1 is March, month 12 is February. It was used in early Christian chronography and influenced the Ethiopian calendar tradition.

Formula

The Alexandrian year starts 25 March. Era offset from the Alexandrian creation epoch (5493 BCE). Converted to Julian coordinates then to JD:

$$\text{Mar–Dec:}\; Y_J = Y - 5493,\; M_J = M + 2$$

$$\text{Jan–Feb:}\; Y_J = Y - 5492,\; M_J = M - 10$$

$$\mathrm{JD} = \mathrm{julianToJD}(Y_J,\, M_J,\, D)$$

def alexandrian_to_jd(Y, M, D):
    if M <= 10:  # Mar-Dec
        return julian_to_jd(Y - 5493, M + 2, D)
    else:        # Jan-Feb
        return julian_to_jd(Y - 5492, M - 10, D)

Algorithm source

Twelve months from March: March, April, May, June, July, August, September, October, November, December, January, February.

Seleucid Calendar

Solar

The Seleucid era (Anno Graecorum, "Era of the Greeks") counts from the reconquest of Babylon by Seleucus I Nicator in 312 BCE. It was the most widely used era in the eastern Mediterranean and Near East for over a millennium.

The calendar uses Julian calendar mechanics with an October 1 year start and the Seleucid era offset. It was used in Syriac, Jewish, and Arab communities well into the Islamic period and is still referenced in some Eastern Christian liturgical traditions.

Formula

The Seleucid year starts 1 October. Era offset of 312/311 years from the Macedonian reckoning of the Seleucid era (312 BCE). Converted to Julian, then to JD:

$$\text{Oct–Dec:}\; Y_J = Y - 312,\; M_J = M + 9$$

$$\text{Jan–Sep:}\; Y_J = Y - 311,\; M_J = M - 3$$

$$\mathrm{JD} = \mathrm{julianToJD}(Y_J,\, M_J,\, D)$$

def seleucid_to_jd(Y, M, D):
    if M <= 3:   # Oct-Dec
        return julian_to_jd(Y - 312, M + 9, D)
    else:        # Jan-Sep
        return julian_to_jd(Y - 311, M - 3, D)

Algorithm source

Twelve months from October: October, November, December, January, February, March, April, May, June, July, August, September.

Syriac Calendar

Solar

The Syriac calendar uses the Seleucid era (year 1 = 312 BCE) with Syriac month names and a January–December year structure, unlike the October-start Seleucid calendar.

It is effectively the Julian calendar with a simple era offset of 311 years. The Syriac month names derive from the Babylonian calendar via Aramaic and remain in use in modern Levantine Arabic dialects.

Formula

The Syriac calendar uses the Seleucid era but with a January–December year (unlike the October-start Seleucid). Simple era offset of 311 years applied to a Julian year:

$$Y_J = Y - 311$$

$$\mathrm{JD} = \mathrm{julianToJD}(Y_J,\, M,\, D)$$

def syriac_to_jd(Y, M, D):
    return julian_to_jd(Y - 311, M, D)

Algorithm source

Twelve months: Kānūn Ṭrāyānā (Jan), Šbāṭ (Feb), Āḍār (Mar), Nīsān (Apr), Ayyār (May), Ḥzīrān (Jun), Tammūz (Jul), Āb (Aug), Aylūl (Sep), Tišrīn Qdīm (Oct), Tišrīn Ḥrāy (Nov), Kānūn Qdīm (Dec).

Macedonian Calendar

Solar

The Syro-Macedonian calendar uses the Macedonian month names with the Seleucid era and an October year start. It was the standard civil calendar across the Hellenistic East after Alexander’s conquests.

In its fixed Roman-era form (used in kalkal), each Macedonian month maps directly to a Julian month. Dios = October, Apellaios = November, and so on through Hyperberetaios = September. The conversion is identical to the Seleucid calendar with different month names.

Formula

Same mechanics as the Seleucid calendar (October year start, AG era) but with Macedonian month names. Each Macedonian month maps 1:1 to a Julian month: Dios = Oct, Apellaios = Nov, …, Hyperberetaios = Sep.

$$\text{Oct–Dec:}\; Y_J = Y - 312 \qquad \text{Jan–Sep:}\; Y_J = Y - 311$$

$$\mathrm{JD} = \mathrm{julianToJD}(Y_J,\, M_J,\, D)$$

def macedonian_to_jd(Y, M, D):
    if M <= 3:   # Dios-Audynaios = Oct-Dec
        return julian_to_jd(Y - 312, M + 9, D)
    else:        # Peritios-Hyperberetaios = Jan-Sep
        return julian_to_jd(Y - 311, M - 3, D)

Algorithm source

Twelve months from October: Dios, Apellaios, Audynaios, Peritios, Dystros, Xanthikos, Artemisios, Daisios, Panemos, Loos, Gorpiaios, Hyperberetaios.

Rūmī Calendar

Solar

The Rūmī calendar was the fiscal and civil calendar of the Ottoman Empire, based on the Julian calendar with an era offset tied to the Hijra. It was used for administrative purposes alongside the lunar Hijri calendar for religious ones.

After the 1840s reform (Tanzimat), the Rūmī calendar used a January–December year with year = Julian year − 584. kalkal implements this post-reform version. Turkey abolished the Rūmī calendar in 1926 in favour of the Gregorian.

Formula

After the 1840 reform, the Rūmī calendar uses January–December months with Julian lengths. The year number is the Julian year minus 584 (a Hijra-era offset):

$$Y_J = Y + 584$$

$$\mathrm{JD} = \mathrm{julianToJD}(Y_J,\, M,\, D)$$

def rumi_to_jd(Y, M, D):
    return julian_to_jd(Y + 584, M, D)

Algorithm source

Twelve months with Julian names and lengths, January–December.

Roman Calendar

Solar

The Julian calendar with traditional Roman date notation: Kalends, Nones, and Ides. Years counted Ab Urbe Condita (AUC) from the founding of Rome in 753 BCE.

Uses AUC year numbering with Latin month names. Days are expressed by counting inclusively backward from three fixed points: Kalendae (1st), Nonae (5th/7th), and Idus (13th/15th). In March, May, July, and October the Nones fall on the 7th and the Ides on the 15th; in all other months, on the 5th and 13th respectively.

Formula

Ab Urbe Condita year 1 corresponds to 753 BCE (Varronian reckoning). Julian calendar with era offset:

$$Y_J = Y - 753$$

$$\mathrm{JD} = \mathrm{julianToJD}(Y_J,\, M,\, D)$$

def auc_to_jd(Y, M, D):
    return julian_to_jd(Y - 753, M, D)

Algorithm source

Twelve months with Latin names: Ianuarius, Februarius, Martius, Aprilis, Maius, Iunius, Iulius, Augustus, September, October, November, December.

Spanish Era

Solar

The Spanish Era (Era Hispanica) counts from 38 BCE, traditionally linked to the Roman conquest of Iberia under Augustus. It was the standard dating system in the Iberian Peninsula and southern France for over a thousand years.

The calendar uses Julian calendar mechanics with an era offset of 38 years. Aragon abandoned it in 1350, Castile in 1383, and Portugal in 1422. It appears frequently in medieval Iberian charters and chronicles.

Formula

The Era Hispanica begins 1 January 38 BCE, marking the Roman pacification of Iberia. Julian calendar with era offset:

$$Y_J = Y - 38$$

$$\mathrm{JD} = \mathrm{julianToJD}(Y_J,\, M,\, D)$$

def spanish_to_jd(Y, M, D):
    return julian_to_jd(Y - 38, M, D)

Algorithm source

Twelve months with Julian names and lengths, January–December.

Olympiad Calendar

Solar

The Olympiad dating system counts 4-year cycles from the first Olympic Games in 776 BCE. It was the principal chronological framework for Greek historians such as Thucydides, Polybius, and Diodorus Siculus.

In kalkal, the Olympiad is implemented as a linear year count from 776 BCE (year 1 = 776 BCE, year 5 = 772 BCE = Olympiad 2 year 1). The display shows both the linear year and the traditional “Olympiad N, year K” notation.

Formula

Linear year count from 776 BCE (the first Olympic Games). Julian calendar with era offset. Olympiad numbering divides the linear count into 4-year cycles:

$$Y_J = Y - 776$$

$$\mathrm{Olympiad} = \left\lfloor \frac{Y-1}{4} \right\rfloor + 1 \qquad \mathrm{year} = ((Y\!-\!1) \bmod 4) + 1$$

def olympiad_to_jd(Y, M, D):
    return julian_to_jd(Y - 776, M, D)

def display(Y):
    return (Y - 1) // 4 + 1, (Y - 1) % 4 + 1

Algorithm source

Twelve months with Julian names and lengths, January–December.

Hebrew Calendar

Lunisolar

The Hebrew (Jewish) calendar is a lunisolar calendar used for Jewish religious observances and as an official calendar of Israel alongside the Gregorian. Its epoch (Anno Mundi) is the calculated creation of the world in 3761 BCE.

The calendar uses a 19-year Metonic cycle in which 7 years are leap years with an added 13th month (Adar II). Year lengths vary between 353–385 days due to postponement rules (dechiyot) that prevent certain holidays from falling on inconvenient weekdays. Month lengths of Cheshvan and Kislev vary to accommodate these adjustments.

Formula

The Hebrew calendar determines New Year (1 Tishrei) via the molad — the mean lunar conjunction. From the year number, the number of elapsed months and fractional day parts are computed:

$$\mathrm{months} = \left\lfloor \frac{235Y - 234}{19} \right\rfloor \qquad \mathrm{parts} = 12\,084 + 13\,753 \cdot \mathrm{months}$$

The raw molad day is then adjusted by four postponement rules (dechiyot) that prevent Rosh Hashana from falling on Sunday, Wednesday, or Friday, and handle year-length constraints:

$$\mathrm{day} = \mathrm{months} \cdot 29 + \left\lfloor \frac{\mathrm{parts}}{25\,920} \right\rfloor$$

A year is leap (13 months, with Adar II) when $(7Y + 1) \bmod 19 < 7$. Year length ranges from 353 to 385 days.

EPOCH = 347997.5

def is_leap(Y):
    return (7 * Y + 1) % 19 < 7

def delay1(Y):
    months = (235 * Y - 234) // 19
    parts = 12084 + 13753 * months
    day = months * 29 + parts // 25920
    return day + 1 if (3 * (day + 1)) % 7 < 3 else day

def delay2(Y):
    last, present, nxt = delay1(Y-1), delay1(Y), delay1(Y+1)
    if nxt - present == 356: return 2
    if present - last == 382: return 1
    return 0

def new_year_jd(Y):
    return EPOCH + delay1(Y) + delay2(Y)

Algorithm source

Twelve or thirteen months: Tishrei (30), Cheshvan (29/30), Kislev (29/30), Tevet (29), Shevat (30), Adar / Adar I (29/30), [Adar II (29)], Nisan (30), Iyar (29), Sivan (30), Tammuz (29), Av (30), Elul (29).

Before Present

Solar

Before Present (BP) is a time scale used in archaeology, geology, and other sciences. By convention, "present" is fixed at 1 January 1950 CE, the reference date for radiocarbon dating.

BP years count backward from 1950: BP 0 = 1950 CE, BP 1 = 1949 CE, BP 2000 = 50 BCE. The system uses Gregorian calendar mechanics with the year inverted relative to 1950.

Formula

Before Present counts backward from 1950 CE (the radiocarbon dating reference). BP 0 = 1950, BP 1 = 1949, etc. Gregorian conversion with inverted year:

$$Y_G = 1950 - Y$$

$$\mathrm{JD} = \mathrm{gregorianToJD}(Y_G,\, M,\, D)$$

def bp_to_jd(Y, M, D):
    return gregorian_to_jd(1950 - Y, M, D)

Algorithm source

Twelve months with Gregorian names and lengths.

Human Era

Solar

The Human Era (Holocene Era, HE) adds 10,000 years to the Gregorian calendar, placing its epoch at approximately the start of the Holocene geological epoch and the beginnings of human civilization (~10,000 BCE).

Proposed by Cesare Emiliani in 1993, it provides a continuous year count that encompasses all of recorded human history without negative years. Year 1 HE = 10,001 BCE; year 12,024 HE = 2024 CE.

Formula

The Holocene Era adds 10,000 years to the Gregorian calendar, placing the epoch at the approximate start of human civilisation. Year 1 HE = 10,001 BCE:

$$Y_G = Y - 10\,000$$

$$\mathrm{JD} = \mathrm{gregorianToJD}(Y_G,\, M,\, D)$$

def human_to_jd(Y, M, D):
    return gregorian_to_jd(Y - 10000, M, D)

Algorithm source

Twelve months with Gregorian names and lengths.