Skip to content

Sunnah Times

Sunnah times are recommended times for night prayer (Qiyam/Tahajjud), derived from the period between Maghrib and Fajr.

from datetime import datetime
from alfalak import PrayerTimes, SunnahTimes, CalculationMethod
prayer_times = PrayerTimes(
(35.7750, -78.6336),
datetime.now(),
CalculationMethod.MUSLIM_WORLD_LEAGUE,
)
sunnah = SunnahTimes(prayer_times)
print(f"Middle of the night: {sunnah.middle_of_the_night}")
print(f"Last third: {sunnah.last_third_of_the_night}")
Marker Meaning
middle_of_the_night Midpoint between Maghrib and Fajr
last_third_of_the_night Start of the last third of the night (recommended for Qiyam)
from zoneinfo import ZoneInfo
tz = ZoneInfo("America/New_York")
prayer_times = PrayerTimes(
coordinates,
datetime.now(),
CalculationMethod.MUSLIM_WORLD_LEAGUE,
time_zone=tz,
)
sunnah = SunnahTimes(prayer_times)

The calculation uses absolute elapsed time (UTC internally), so markers are correct even on nights with DST transitions.