Physics Stack Exchange is a question and answer site for active researchers, academics and students of physics. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

There are many formulas for determining sunrise and sunset times for locations, but for my application I only need to know if it is day or night (given a time, latitude and longitude).

After studying the terms azimuth, altitude/elevation, and zenith, I am curious if I can calculate the sun's elevation, and use that value to determine day/night status alone.

As I understand it, any value below the horizon (taking into consideration the various values for twilight) should tell me that it is night. I should be able to use -6 for civil twilight, -12 for nautical twilight, etc.

Do I need to worry about azimuth also?

share|cite|improve this question
up vote 4 down vote accepted

Yes, knowing the sun's elevation is generally enough to determine how dark it is, at least to a first approximation.

However, if you're using a simple geometric formula for the elevation, keep in mind that you may need to adjust it for atmospheric refraction. Wikipedia's sunrise article has a pretty nice explanation of this:

"Sunrise occurs before the Sun actually reaches the horizon because the Sun's image is refracted by the Earth's atmosphere. The average amount of refraction is 34 arcminutes, though this amount varies based on atmospheric conditions.

Also, unlike most other solar measurements, sunrise occurs when the Sun's upper limb, rather than its center, appears to cross the horizon. The apparent radius of the Sun at the horizon is 16 arcminutes.

These two angles combine to define sunrise to occur when the Sun's center is 50 arcminutes below the horizon, or 90.83° from the zenith."

In general, if you're just comparing the elevation to some fixed threshold, it's enough to adjust the threshold to account for this.

share|cite|improve this answer
Aha, this must be why "official" twilight is 90° 50'. Thanks for the background on that! – JYelton Apr 9 '12 at 14:16

All you need is altitude. Azimuth is strictly what compass heading to look toward to hunt for the Sun.

share|cite|improve this answer
Thanks! Also, phrasing it, "hunt for the Sun" I found quite funny. :) – JYelton Apr 9 '12 at 14:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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