Daylight Duration Calculator Formula
Understand the math behind the daylight duration calculator. Each variable explained with a worked example.
Formulas Used
Daylight Hours
day_hours = (2 / 15) * (180 / pi) * acos(-tan(latitude * pi / 180) * tan(declination * pi / 180))Night Hours
night_hours = 24 - (2 / 15) * (180 / pi) * acos(-tan(latitude * pi / 180) * tan(declination * pi / 180))Variables
| Variable | Description | Default |
|---|---|---|
latitude | Latitude(°) | 40.7 |
declination | Solar Declination(°) | 23.44 |
How It Works
Daylight Duration
The number of hours between sunrise and sunset depends on latitude and the Sun's declination (which changes through the year).
Formula
D = (2/15) × arccos(-tan(φ) × tan(δ)) hours
where φ = latitude and δ = solar declination (both in degrees, converted to radians for calculation).
Solar declination ranges from -23.44° (Dec solstice) to +23.44° (Jun solstice).
Worked Example
New York (40.7°N) at summer solstice (declination = 23.44°).
latitude = 40.7declination = 23.44
- 01cos(H) = -tan(40.7°) × tan(23.44°)
- 02= -0.860 × 0.433 = -0.3726
- 03H = arccos(-0.3726) = 111.86°
- 04D = 2 × 111.86 / 15 = 14.91 hours of daylight
Ready to run the numbers?
Open Daylight Duration Calculator