◆ How Zmanim Are Calculated

This page documents the exact algorithms and halachic opinions used by ZmanimPro. All calculations are performed by the open-source PhpZmanim library (LGPL-2.1), a PHP port of Eliyahu Hershfeld's KosherJava API.

1. Solar Position (Sunrise & Sunset)

Sunrise and sunset are computed using the NOAA Solar Calculator, based on Jean Meeus' Astronomical Algorithms (2nd edition, Willmann-Bell, 1998). The key formula:

cos(H) = (sin(h₀) − sin(φ)·sin(δ)) / (cos(φ)·cos(δ))

Where:

The value −0.833° accounts for:

Accuracy: ±0.01° in solar position, corresponding to roughly ±1 minute of time at mid-latitudes.

2. Halachic Hours (Sha'ot Zmaniyot)

Jewish law divides daylight into 12 equal "halachic hours." There are two primary opinions on what counts as "daylight":

OpinionDay startsDay endsUsed by
GRA (Vilna Gaon)Sunrise (netz)Sunset (shkiah)Most Ashkenazi & Sephardi communities today
Magen AvrahamDawn (alot haShachar, 72 min before sunrise)Nightfall (tzait haKochavim, 72 min after sunset)Some Hasidic & Sephardi communities

A halachic hour under the GRA = (sunset − sunrise) ÷ 12. We display GRA times by default; Magen Avraham times are available on request via the API.

3. Key Zmanim Formulas

ZmanDefinition (GRA)
Alot HaShacharSun 72° below horizon (some say 16.1°)
MisheyakirSun 11.5° (or 10.2°) below horizon
Sof Zman Shema3 halachic hours after sunrise
Sof Zman Tefillah4 halachic hours after sunrise
Chatzos (midday)6 halachic hours after sunrise = (sunrise + sunset) ÷ 2
Mincha Gedola6.5 halachic hours after sunrise
Mincha Ketana9.5 halachic hours after sunrise
Plag HaMincha10.75 halachic hours after sunrise
Shkiah (sunset)Sun's upper limb below horizon
Tzait HaKochavim (8.5° GRA)Sun 8.5° below horizon (~36 min at equinox) — standard Tzait HaKochavim
Tzait HaKochavim (72 min)72 fixed minutes after sunset (Rabbeinu Tam simplified)
Tzait HaKochavim (16.1° Rabbeinu Tam)Sun 16.1° below horizon (~72 min at equinox) — Rabbeinu Tam degrees opinion

4. Candle Lighting Time

Candle lighting marks the acceptance of Shabbat. The time is computed as sunset − candle offset:

CityOffsetBasis
Jerusalem40 minutesYereim (Rabbeinu Elchanan); also accounts for 825m elevation
Most communities18 minutesWidely adopted Roman/Pest custom
Some communities20, 22, or 30 minutesLocal communal custom (minhag)

5. Havdalah (End of Shabbat)

Havdalah is recited at nightfall (tzait haKochavim), when three medium-sized stars are visible. We display the 72-minute opinion (Rabbeinu Tam simplified) by default, and also show 8.5° (GRA) (~36 min at equinox, the standard Tzait HaKochavim) and 16.1° (Rabbeinu Tam degrees) (~72 min at equinox) times.

Rabbeinu Tam (a more stringent opinion) defines nightfall as 4 mil after sunset. This is calculated either as fixed 72 minutes (4 × 18 min/mil) or astronomically as 16.1° below the horizon. Many observant individuals wait for this time before performing melacha (work forbidden on Shabbat), as a stringency (lechumra).

6. Hebrew Calendar Algorithm

The Hebrew calendar is computed by the algorithm described by Maimonides in Hilchot Kiddush HaChodesh (12th century) and refined by Gauss (1802). Key rules:

This is implemented in PhpZmanim's JewishCalendar class, which we use for all Hebrew-date conversions on this site.

7. Sources of Variation

Minor differences (1–2 minutes) can occur between Zmanim calculators due to several methodological factors. Understanding these helps explain why times may differ slightly from one source to another:

PhpZmanim supports multiple calculators (NoaaCalculator, SunTimesCalculator, ZmanimCalculator), allowing users to select the precision level they need. Our default configuration uses the NOAA calculator, which balances accuracy and computational efficiency.

Frequently Asked Questions

What algorithm does ZmanimPro use to calculate sunrise and sunset?

We use the NOAA Solar Calculator, based on Jean Meeus' "Astronomical Algorithms" (2nd edition, 1998). The formula computes the sun's declination and hour angle, then applies the standard altitude of -0.833° (the sun's upper limb appears on the horizon, accounting for 34' atmospheric refraction and 16' solar radius).

Why is candle lighting 18 minutes before sunset in most cities?

The 18-minute custom (Roman/Pest) is a widely adopted stringency to ensure candles are lit before Shabbat begins. Some communities use 20, 22, or 30 minutes. Jerusalem uses 40 minutes, based on the Yereim and the city's elevation.

What is tzait haKochavim (nightfall)?

Tzait haKochavim is when three medium-sized stars are visible, marking the end of Shabbat and holidays. The GRA opinion calculates this as the sun being 8.5° below the horizon. The 72-minute opinion is also widely used.

How accurate are the calculations?

The NOAA algorithm is accurate to ±0.01° in solar position, corresponding to roughly ±1 minute of time at most latitudes. Elevation and atmospheric conditions can introduce small variations.