What this calculator does
The Daylight Hours Calculator estimates how many hours of daylight a location receives on a given date, based only on its latitude and the day of the year. It is a universal astronomical model — it works for anywhere on Earth and does not depend on time zone or country. The result is the geometric day length (sunrise to sunset of the Sun's center), not adjusted for atmospheric refraction or the Sun's apparent size.
How to use it
Enter the latitude in degrees (positive for the Northern Hemisphere, negative for the Southern Hemisphere) and the day of the year \(N\), where January 1 is 1 and December 31 is 365. The calculator returns the daylight length in decimal hours and as hours-and-minutes, along with the night length and the Sun's declination on that date.
The formula explained
First the Sun's declination is found:
$$\delta = 23.45\sin\left(\frac{360}{365}(284+N)\right) \text{ degrees}$$This swings between about \(+23.45°\) at the June solstice and \(-23.45°\) at the December solstice. The hour angle of sunrise \(H\) satisfies \(\cos(H) = -\tan(\phi)\tan(\delta)\). Since the Sun travels \(360°\) in 24 hours, the full daylight arc \((2H)\) converts to
$$D = \frac{24}{\pi}\arccos(-\tan\phi\,\tan\delta) \text{ hours}$$Near the poles the cosine can exceed \(\pm 1\), giving 24 hours (midnight sun) or 0 hours (polar night).
Worked example
At latitude 40°N on the summer solstice (\(N = 172\)): \(\delta \approx 23.45°\). Then
$$-\tan(40°)\tan(23.45°) \approx -0.8391 \times 0.4337 \approx -0.3639$$$$\arccos(-0.3639) \approx 1.9437 \text{ rad}$$so
$$D = \frac{24}{\pi} \times 1.9437 \approx 14.85 \text{ hours of daylight}$$FAQ
Why does it not match my weather app exactly? Apps add atmospheric refraction and define sunrise as the upper edge of the Sun touching the horizon, adding roughly 5–10 minutes. This is the pure geometric center-of-Sun day length.
What latitude range is valid? Between about \(-66.5°\) and \(+66.5°\) you always get a value between 0 and 24. Beyond the polar circles the result saturates to 0 or 24 hours.
What is day-of-year for a specific date? Count the days from January 1. For example, June 21 \(\approx\) day 172 in a non-leap year.