I derived the following formula to estimate sunrise and sunset times:

$$ t=\pm\cos^{-1}\frac{\sin\theta-\sin L_{loc}\sin L_{sun}}{\cos L_{loc}\cos L_{sun}} $$

  • $L_{loc}$ is the local latitude
  • $L_{sun}$ is the solar latitude
  • $\theta$ is the desired solar altitude angle (for sunset and sunrise, I used $\theta=0$)
  • $t$ is the time, expressed as an angle of a 24-hour clock, and measured from solar noon

I used the solar latitude from here, and the times and local latitude for New York from here (it was October 20, 2020; link to correct month).

I tried this with my location and was about 4 minutes off with sunrise and sunset, and I tried it for New York and was also about 4 minutes off (I got 7:18:15am for sunrise and 6:02:55pm for sunset).

I'm wondering what are the main sources of error in my formula? My goal is for it to be accurate at least within a minute, and hopefully even down to a few seconds. What factors do I need to take into account in order to reach this level of accuracy?


  • 1
    $\begingroup$ The symbol for latitude is traditionally $\phi$. Declination is $\delta$. And your $t$ is called the hour angle, $\omega_0$. $\endgroup$ – JEB Oct 21 at 2:16
  • $\begingroup$ @JEB: Thanks! I'll leave my question as is, but I'll take note of these for the future. Is there a traditional symbol for the solar altitude angle? $\endgroup$ – Matt Oct 21 at 2:37
  • 1
    $\begingroup$ Check: en.wikipedia.org/wiki/Sunrise_equation $\endgroup$ – JEB Oct 21 at 2:57

Your error is assuming that sunrise and sunset occur at $\theta = 0$, this is incorrect for two reasons. The first being the sun's disk has a diameter of $0.5^{\circ}$, and the second is atmospheric refraction causes distortion which change the sun's apparent location on the horizon. Altogether, at sea level this leads to an angle of correction of about $-0.83^{\circ}$, use this as your theta.

| cite | improve this answer | |
  • $\begingroup$ Thanks! That definitely got me a lot closer. I'm now usually within a minute. Anything else that I should be taking into account? $\endgroup$ – Matt Oct 21 at 4:34

Not the answer you're looking for? Browse other questions tagged or ask your own question.