Hebrew Calendar C Library

Jewish calendar computations in plain C — dates, festivals, zmanim, readings and haftarot.

BSD 3-Clause · C11 · no dependencies beyond the standard library

It powers the Hebrew Calendar app

The dates, zmanim and readings in the Hebrew Calendar Zmanim app — on the App Store and on Google Play — are computed by this library, on the phone and without a network. It is small, allocation-free in its calculations, and easy to call from Swift, Kotlin or Dart.

What it does

Dates

Jewish, Gregorian and Julian calendars, converted in any direction; leap years, month lengths, the day of the week and the keviut of a year.

Festivals and fasts

Yom Tov, chol hamoed, rosh chodesh, fasts and their deferrals, the named Shabbatot, eruv tavshilin and the arba parshiyot, for Israel and for the diaspora. Chametz deadlines and fast times come with the day they belong to.

Zmanim

One call fills a struct with the day's times, from the NOAA solar calculations: sunrise and sunset, dawn and nightfall in several opinions, candle lighting, and the halachic hours between them.

Tekufot

The four solar seasons according to Shmuel or Rav Ada, the arithmetic behind Tal uMatar and Birkat HaChama.

Torah readings

The weekly parsha and its aliyot, festival and special readings, and haftarot across twenty-six customs, with the sizes and offsets a caller needs to walk the results from another language.

Checked against its sibling

A Java library computes the same calendar for the web. The two are diffed day by day, and both are checked against opentorah.

Using it

Build it with CMake; it needs nothing but a C11 compiler. Calendar names and reading schedules come from the shared hebrewcalendar-data repository, included as a submodule and generated into C headers.

#include "hconverter.h"
#include "zmanim.h"

/* A Gregorian date as a Jewish one */
hc_date date = { GREGORIAN, 2026, 9, 18 };
hc_convert(&date, HEBREW);          /* 7 Tishrei 5787: year 5787, month 7, day 7 */

/* The day's zmanim in Montreal */
hc_zmanim z;
hc_date   day = { GREGORIAN, 2026, 9, 18 };
hc_compute_zmanim(&day, 45.5017, -73.5673, -4.0, 0, 0, &z);
double sunset = z.shkiah;            /* minutes from midnight, local time */

The API documentation covers the rest.

See also

hebrewcalendar.net

The same calendar on the web: zmanim, readings and daily learning in four languages, and the displays that hang in shuls.

The Java library

Its sibling, which computes the site, and the reference this library is diffed against.

opentorah.org

Where the Torah reading and haftarah data comes from, custom by custom.

hebrewcalendar-data

Calendar names, reading schedules and learning cycles, shared by both libraries and generated into C, Java and Dart.