Prayer Times Calculation
Zuhr

Calculating Zuhr Time

Overview

  1. Calculate the solar noon time
  2. Add the equotion of time to the apparent solar noon time
  3. Add an additional amount of minutes to reach the time when the sun has fully passed its zenith and starts to decline

Calculation Step by Step

1. Local solar noon time

Solar noon time is calculated by first determining the real local time (not the time of the local time zone but of the actual local coordinates), and afterwards adding a correction factor to account for the equation of time (EoT).

Solar Noon Time=12:00 h+Standard Meridian LongitudeLocal Longitude15EoT\text{Solar Noon Time} = \text{12:00 h} + \frac{\text{Standard Meridian Longitude}-\text{Local Longitude}}{15} - \text{EoT}

Where:

  • Standard Meridian Longitude=15º×UTC-Offset\text{Standard Meridian Longitude} = {15º} \times \text{UTC-Offset}
  • EoT\textit{EoT} = Equation of time

3. Additional minutes

We have to make sure that we calculate not the time when the sun reachtes its zenith, but rather the time it has actually visibly passed its zenith and started to decline. Therefore, we add some duration to the time that resulted from the second step.

There are different opinions on how much time to add. We determine that additional time to be 2 minutes.

Example

  • Date: May 1st, 2024
  • Local time zone: UTC+2
  • Longitude: 6°
  • EoT: 2.95 minutes (= 2:57 min)

13:35 h=12:00 h+(15×2)615h2.57 min+2 min\text{13:35 h} = \text{12:00 h} + \dfrac{(15\times2)-6}{15}\text{h} - 2.57 \text{ min} + 2\text{ min}

Code Implementation

../prayertimes2025//pt_engine/compute_times/compute_shurouq_maghrib_time.py


from math import sqrt
from datetime import datetime, timedelta
from pt_engine.astro_helpers import hour_angle_for_solar_altitude


def compute_shurouq_maghrib_time(pt_type: str, date: datetime, utc_offset: float, latitude: float, longitude: float,  declination: float, eot: float, observer_height: int = 0, horizon_height: int = 0) -> datetime:

    # Calculate Solar Noon Time
    standard_meridian = 15 * utc_offset
    local_time_correction = (standard_meridian - longitude) / 15
    solar_noon = timedelta(hours=12) + timedelta(hours=local_time_correction) - timedelta(minutes=eot)

    # Determine the angle at which sunset and sunrise occur
    solar_altitude_angle = 0

    # Adjust by Solar radius (half of the sun's angular diameter) to consider upper disk of the sun not the center
    solar_radius = 0.26667
    solar_altitude_angle = solar_altitude_angle - solar_radius

    # Adjust the solar altitude angle based on the observer's height above sea level
    height_difference = observer_height - horizon_height
    height_adjustment = 2.076 * sqrt(height_difference) / 60 if height_difference > 0 else 0
    solar_altitude_angle = solar_altitude_angle - height_adjustment

    # Adjust the solar altitude angle based on the observer's atmospheric refraction
    atmospheric_refraction = 0.583
    solar_altitude_angle = solar_altitude_angle - atmospheric_refraction

    # Adjust by Horizontal Parallax correction (Sun's parallax is about 8.794 arcseconds)
    horizontal_parallax = 8.794 / 3600
    solar_altitude_angle = solar_altitude_angle - horizontal_parallax

    # Calculate Hour Angle H for the determined solar_altitude_angle
    hour_angle = hour_angle_for_solar_altitude(latitude, declination, solar_altitude_angle)

    prayer_time = None

    if pt_type == 'shurouq':
        # Calculate Shurouq Time
        prayer_time = datetime.combine(date, datetime.min.time()) + solar_noon - timedelta(hours=hour_angle / 15)
    elif pt_type == 'maghrib':
        #  Calculate Maghrib Time
        prayer_time = datetime.combine(date, datetime.min.time()) + solar_noon + timedelta(hours=hour_angle / 15)
    else:
        raise ValueError("Invalid type. Must be 'shurouq' or 'maghrib'")
    return prayer_time
↗ View in github