Descriptions of the calendar systems supported by kalkal
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$$
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:
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:
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).
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).
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$.
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).
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).
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$$
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$$
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$$
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:
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$$
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):
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:
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:
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:
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:
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:
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:
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: