The Position of The Sun and The Moon

First created: Thu Apr 6 2000
Last update: Thu Apr 6 2000

Altitude and Azimuth Calculator

Moon and Sun altitude and azimuth, and the phase of the Moon calculator

The dates and times used by the calulator are consistently UTC. Look for the maximum solar altitude around noon local time. The azimuth plot will show the Sun due South (or North if you live "down under"). Sunrise and sunset are when the Sun crosses altitude 0.

for new jersey:

To get local time in NJ, subtract 5 hours from UTC in the winter, 4 in the summer. Noon local time will then be 17:00 or 16:00 UTC.

Special Cases

Try to generate the following plots.

A 1 day plot to determine sunrise and moonrise. Note the highest position of the sun. It will be around 12:00 local time for the longitude and latitude specified. From there check the UTC offset in sign and magnitude.

A 7 day plot and observe the Moon and Sun motions shifting in relative phase.

A 28 day plot and observe one full cycle of the Moon's maximum altitude during the course of a lunar month. The Sun's altitude also varies but takes a full calendar year to cycle.

A 90 day plot and note the clear quarter solar cycle.

A 365 day plot to see a full solar cycle and approx 12 lunar cycles.

The last two plots strain the server -- please use sparingly!


I verified the numbers produced by this program using those of the U.S. Naval Observatory. Here is a comparison table for Jan 1, 2000. The errors, when there are any, are very small. (The USNO does not provide the negative altitudes).


altaz.cpp. Source code for the calculator.
How to compute planetary positions. Exceptionally clear, concise and useful. It provides the basis for the program discussed here. (local copy).
Newton's 1702 Lunar Theory, Nicholas Kollerstrom's PhD thesis. A web treasure and a must read.
U.S. Naval Observatory. Sun and Moon altitude/azimuth tables for one day.