How this instrument works
Solar declination is the latitude on Earth where the Sun sits directly overhead at solar noon on a given date. It swings between +23.45° and −23.45° across the year because Earth's axis is tilted 23.45° from the plane of its orbit — the tilt, not distance from the Sun, is what drives the seasons. The formula used here is P.I. Cooper's 1969 approximation, which treats that swing as a single sine wave: δ ≈ 23.45·sin(2π(284+N)/365). The constant 284 shifts the wave's peak to land near day 172, the June solstice, when the tilt points the Northern Hemisphere most directly at the Sun.
Day length comes from a different piece of geometry, the sunrise equation. At the instant of sunrise or sunset, the Sun sits exactly on the horizon, and the hour angle at that moment satisfies cos H₀ = −tanφ·tanδ, where φ is latitude. Earth turns 15° of hour angle every hour, so doubling H₀ and converting it from radians to hours produces the 24/π factor in front of the arccosine. The instrument clamps that cosine argument to the range [−1, 1] before inverting it, because past the Arctic or Antarctic Circle the raw value can exceed 1 in magnitude — exactly the geometry of a day that never ends or never starts.
Both formulas assume a level horizon and a Sun with no width, viewed through no atmosphere, so actual sunrise and sunset run a few minutes earlier and later than the arithmetic predicts — refraction lifts the visible disc before it is geometrically above the horizon, and the disc itself has measurable size. That gap is trivial for the people who actually reach for this pair of equations: agronomists blocking out a planting calendar, photovoltaic installers estimating a panel's daily sun-hours, or field ecologists tracking a photoperiod-triggered migration. It is the wrong tool for a sailor timing civil twilight to the minute.
- Enter Latitude in degrees, positive for the Northern Hemisphere and negative for the Southern — 40 for New York or Madrid, −33 for Sydney.
- Enter Day of year (1-365; ~172 = summer solstice, ~355 = winter solstice) as the calendar day number you want to check.
- Read Solar declination, degrees — the Sun's position relative to the equatorial plane on that date, the same for every latitude.
- Read Day length, hours — how long the Sun stays above the horizon at that latitude on that day.
- Change Day of year at a fixed Latitude to watch Day length, hours climb toward the solstice and fall back toward the equinox.
Worked example — day length at 40°N on the June solstice
Take Latitude 40° north — the parallel running through New York and Madrid — and Day of year 172, three days before the calendar solstice but close enough that the Sun's declination sits almost at its yearly ceiling. The formula returns δ = 23.4497828468°, a hair under the theoretical maximum of 23.45°, which is exactly what you would expect with the Sun nearly overhead at the Tropic of Cancer.
Feed that latitude and declination into the day-length formula and the arccosine works out to 14.8459499216 hours — just under fifteen hours of sunlight, the longest day of the year at 40°N. Run the same latitude through day 355 instead and the formula returns roughly 9.15 hours, a swing of nearly six hours between solstices produced entirely by the 23.45° tilt of the planet.
Questions
Why does the declination formula use 284 instead of the actual solstice date?
The constant 284 shifts the sine wave's peak to land near day 172, the Northern Hemisphere's June solstice, without a separate lookup table for calendar months or leap years. It is a fixed part of Cooper's 1969 approximation rather than a value to adjust — changing it would shift every declination figure the formula produces, not just one date.
How accurate is the 23.45·sin() approximation for declination?
Within roughly a quarter of a degree of the true value across most of the year, which is close enough for scheduling solar panels or a planting calendar. Earth's slightly elliptical orbit and its axial wobble add small higher-frequency terms that one sine term cannot capture; agencies that need sub-arcminute precision, such as for telescope pointing, use a longer Fourier series instead.
What happens above the Arctic Circle, where the Sun never sets?
The term −tanφ·tanδ can fall outside the range a cosine can ever return, which is exactly the geometry of continuous daylight or continuous darkness. The formula clamps that value to [−1, 1] before taking the inverse cosine, so it reports 24 hours for a Sun that never sets and 0 hours for one that never rises, instead of returning an error.
Does the day-length figure account for atmospheric refraction or the Sun's size?
No — it treats the Sun as a single point crossing a perfectly flat horizon. Real sunrises happen a few minutes earlier and sunsets a few minutes later because the atmosphere bends light over the horizon and the solar disc has measurable width. The combined gap usually runs under ten minutes, small enough to ignore for planning but too coarse for precise twilight timing.
Why is latitude entered as a signed number instead of N or S?
Because the formula needs one continuous sign convention to serve both hemispheres at once: north is positive, south is negative. Sydney, at roughly 33°S, goes in as −33, and the tangent inside the day-length formula carries that sign through automatically, producing its longest days in December rather than June.
Can this calculator tell me the clock time of sunrise and sunset?
Not directly — it returns total hours of daylight, not clock times. Getting sunrise and sunset would mean splitting that duration around local solar noon and then correcting for time zone and longitude, steps this instrument does not take; it answers how many hours the Sun is up, not at what time it rises.