How to calculate
Compute the apparent day boundary when the center of the Sun crosses 50 arcminutes below a level horizon. Add the intervals above that boundary that fall within each local calendar day, including a daylight period that carries across midnight.
Worked example
Use Starting local date 2024-06-21 · Number of days to show 1 · Latitude (degrees, north positive) 40.7128 · Longitude (degrees, east positive) -74.006 · Local UTC offset in hours -4. The result is 15:06 daylight.
Input and result notes
The duration uses the crossings before clock times are rounded. A polar day can show 24 hours of daylight and a polar night can show zero. Use the correct local UTC offset, including daylight saving when it applies.
US Naval Observatory solar coordinates
US Naval Observatory definitions of sunrise, sunset, and twilight