| home | contents | send comment | send link | add bookmark |

Lunar Phase Calculator

by Stephen R. Schmitt


Moon's age from new : days Moon is :
Distance : Earth radii
Ecliptic latitude : degrees
Ecliptic longitude : degrees Moon is in :


  1. About
  2. Source code
  3. Discussion


This JavaScript program calculates the phase and position of the moon for a given date. It was adapted from a BASIC program from the Astronomical Computing column of Sky & Telescope, April 1994.

The calculator will initialize itself, if possible, to your computer's day, month, and year. The day, month, and year can be changed using the buttons on the calculator. To advance press one of the [ >> ] keys; to backup, press one of the [ << ] keys.


Source Code

The Java Script source code for this program can be viewed by using the View|Source command of your web browser.

You may use or modify this source code in any way you find useful, provided that you agree that the author has no warranty, obligations or liability. You must determine the suitablility of this source code for your use.



This program helps anyone who needs to know the Moon's phase (age), distance, and position along the ecliptic on any date within several thousand years in the past or future.

The ecliptic longitude is measured from the vernal equinox along the ecliptic in the direction of the sun's apparent motion through the stars. The moon's ecliptic longitude is calculated as well as the corresponding zodiac constellation. The ecliptic latitude is positive if north of the ecliptic and negative if south. The age of the moon in days as well as its visual phase are given.


Copyright © 2004, Stephen R. Schmitt