How to calculate
Compute the equatorial coordinates of the Sun and the local hour angle, then rotate to the local horizon to get elevation and azimuth. Apparent elevation adds an approximate atmospheric correction. Azimuth is measured clockwise from true north.
Worked example
Use Local date 2024-06-21 · Local clock time (HH:MM) 13:00 · Latitude (degrees, north positive) 40.7128 · Longitude (degrees, east positive) -74.006 · Local UTC offset in hours -4 · Elevation to display Geometric elevation. The result is 72.7154105°.
Input and result notes
Dates are supported from 1800 through 2199. Use the UTC offset in effect at that local time. Azimuth becomes undefined when the Sun is exactly overhead or directly below the observer.
US Naval Observatory solar coordinates