Calculation of Prayer Times
Muslims must perform five daily prayers, each at a specific prescribed time. These prayer times are determined by the position of the sun and follow a precise schedule. This document provides an overview of these prayer times and explains the mathematical methods used to calculate them.
1. Definitions
To determine the time interval for each prayer (as well as for fasting), we need to establish eight important points in time during the day. These times are defined in the following table:
| Time | Definition |
|---|---|
| Fajr | The moment when the sky first begins to lighten at dawn. |
| Sunrise | The moment when the first edge of the sun appears above the horizon. |
| Dhuhr | The time when the sun begins to descend after reaching its highest point in the sky (zenith). |
| Asr | The moment when the length of an object's shadow equals a certain factor (typically 1 or 2) of the object's height, plus its shadow length at noon. |
| Sunset | The moment when the sun completely disappears below the horizon. |
| Maghrib | Shortly after sunset. |
| Isha | The time when complete darkness sets in, and there is no longer any scattered twilight light in the sky. |
| Midnight | The midpoint between sunset and sunrise (or in some traditions between sunset and Fajr). |
The next section provides details on how these times can be calculated mathematically for any given location, provided that the geographic coordinates are known.
2. Astronomical Measures
Two important astronomical measures are essential for accurate calculation of prayer times: The Equation of Time and The Sun's Declination.
The Equation of Time represents the deviation between time measured by a sundial and a standard clock. The variation arises due to the Earth's axial tilt and the elliptical shape of its orbit, which cause the sun's apparent motion to vary. As a result, the sundial can be ahead (fast) by up to 16 minutes and 33 seconds (around November 3rd) or behind (slow) by up to 14 minutes and 6 seconds (around February 12th).
The Sun's Declination is the angle between the sun's rays and the Earth's equatorial plane. It varies continuously throughout the year due to the Earth's axial tilt. This tilt — caused by the difference between the Earth's rotational axis and its orbital plane — is responsible for the changing of seasons and affects the calculation of prayer times.
The two aforementioned astronomical measures can be obtained accurately from The Star Almanac, or can be calculated approximately. The following algorithm from the U.S. Naval Observatory calculates the sun's angular coordinates with an accuracy of approximately 1 arcminute within two centuries of the year 2000.
d = jd - 2451545.0 // Julian date offset
g = 357.529 + 0.98560028 * d
q = 280.459 + 0.98564736 * d
L = q + 1.915 * sin(g) + 0.020 * sin(2*g)
R = 1.00014 - 0.01671 * cos(g) - 0.00014 * cos(2*g)
e = 23.439 - 0.00000036 * d
RA = arctan2(cos(e) * sin(L), cos(L)) / 15
D = arcsin(sin(e) * sin(L)) // Sun's declination
EqT = q/15 - RA // Equation of Time
3. Calculation of Prayer Times
To calculate prayer times for a given location, we need to know the location's latitude (L) and longitude (Lng), along with the local timezone. We also obtain the Equation of Time (EqT) and the sun's declination (D) for a given date using the algorithm described in the previous section.
3.1 Dhuhr
Dhuhr can be easily calculated using the following formula:
The above formula actually calculates the noon time, when the sun reaches its highest point in the sky. A small margin is normally added for Dhuhr as a precautionary measure.
3.2 Sunrise and Sunset
The time difference between noon and the time when the sun reaches an angle α below the horizon can be calculated using the following formula:
Astronomical sunrise and sunset occur at α = 0. Due to the refraction of light in the Earth's atmosphere, the actual sunrise appears slightly before the astronomical sunrise, and the actual sunset occurs after the astronomical sunset. Actual sunrise and sunset can be calculated with the following formulas:
If the observer's location is higher than the surrounding terrain, this elevation can be taken into account by slightly increasing the constant 0.833. In practice, however, the constant is considered the same regardless of elevation.
3.3 Fajr and Isha
There are different opinions on which angle should be used to calculate Fajr and Isha. The following table shows several conventions currently used in different countries:
| Convention | Fajr Angle | Isha Angle |
|---|---|---|
| Muslim World League | 18° | 17° |
| Islamic Society of North America (ISNA) | 15° | 15° |
| Egyptian General Authority of Survey | 19,5° | 17,5° |
| Umm al-Qura University, Mekka | 18,5° | 90 min. after Maghrib, 120 min. during Ramadan |
| University of Islamic Sciences, Karachi | 18° | 18° |
| Institute of Geophysics, University of Tehran | 17,7° | 14° * |
| Leva Research Institute, Qum | 16° | 14° |
| Muslims of France | 12° | 12° |
| Spiritual Administration of Muslims of Russia | 16° | 15° |
| Islamic Religious Council of Singapore | 20° | 18° |
* The Isha angle is not explicitly defined in the Tehran method.
For example, according to the Muslim World League convention: Fajr = Dhuhr - T(18) and Isha = Dhuhr + T(17).
3.4 Asr
There are two important scholarly opinions on the calculation of Asr time:
The majority of Islamic schools of jurisprudence (Shafi'i, Maliki, Ja'fari, and Hanbali) state that Asr begins when the length of an object's shadow equals the object's own height plus its shadow length at noon. The Hanafi school follows a different interpretation and maintains that Asr begins when the shadow is twice the length of the object plus its shadow length at noon.
The following formula calculates the time difference between solar noon and the moment when an object's shadow reaches t times its own length, beyond the object's shadow length at noon:
According to the first four schools of jurisprudence, Asr = Dhuhr + A(1), while in the Hanafi school it is Asr = Dhuhr + A(2).
3.5 Maghrib
From a Sunni perspective, the time for the Maghrib prayer begins when the sun has completely disappeared below the horizon, i.e. Maghrib = Sunset (with a precautionary margin of 1-3 minutes).
The dominant Shia view, on the other hand, is that the Maghrib prayer should not be performed until the redness on the eastern sky, visible after sunset, has passed overhead. This is often accounted for by using a twilight angle, so that Maghrib = Dhuhr + T(4).
3.6 Midnight
Midnight is generally calculated as the average time from sunset to sunrise:
From a Shia perspective, the legal midnight (the end time for performing the Isha prayer) is the average time from sunset to Fajr:
4. Higher Latitudes
At locations with higher latitudes, twilight can last all night during certain months of the year. During these abnormal periods, it is not possible to determine Fajr and Isha using the usual formulas mentioned in the previous section. To overcome this problem, several solutions have been proposed, three of which are described below.
Middle of the Night
In this method, the period from sunset to sunrise is divided into two halves. The first half is considered "night", and the second half as "dawn". Fajr and Isha are assumed in this method to be at midnight during the abnormal periods.
One-Seventh of the Night
In this method, the period between sunset and sunrise is divided into seven parts. Isha begins after the first seventh, and Fajr is at the beginning of the seventh part.
Angle-Based Method
This is an intermediate solution used by some newer prayer time calculators. Let α be the twilight angle for Isha, and let t = α/60. The period between sunset and sunrise is divided into t parts. Isha begins after the first part. For example, if the twilight angle for Isha is 15, then Isha begins at the end of the first quarter (15/60) of the night. The time for Fajr is calculated similarly.
In cases where Maghrib is not equal to sunset, the above rules can also be applied to Maghrib to ensure that Maghrib always falls between sunset and Isha during the abnormal periods.
5. Implementation
The formulas described above are implemented in JavaScript by PrayTimes.org and are used by Praay.org for calculating prayer times for all cities. The source code can be viewed at PrayTimes.org.
Praay.org uses these calculations together with precise geographic coordinates to provide accurate prayer times that take into account the challenges posed by higher latitudes, especially around the summer solstice.
6. References
- The Determination of Salat Times, by Dr. Monzur Ahmed.
- Approximate Solar Coordinates, by U.S. Naval Observatory.
- The Islamic Prayer Times, by Professor Tariq Muneer.
- Wikipedia, the free encyclopedia.
- Prayer Times Calculation, PrayTimes.org (original English source).