Skip Site Navigation «



Selected Data

This node is informative, descriptive, functional and terminating.

Query Path

Interactive Path

Description of Results

While perhaps not as old as the moon itself, the history behind the data in the MySQL moon_phases table stretches (to my knowledge at least) as far back as 1987. It began life as the C program moontool. Along the way, various folks have ported it to Java, VB and, in 1998, to Perl by Raino Pikkarainen. These days you can find the Perl version on CPAN as Astro::MoonPhase, which is now maintained by Brett Hamilton of

The idea behind this table is to avoid some heavy-duty floating point calculations at run-time. As you can see from the results, they come back pretty quickly. So, for any requested month in the calendar, I use this table to determine which days any of these moon phases falls on:

A little later on this year I plan on publishing an article on the last, rare, and misunderstood Blue Moon. Hint: check your calendars for August 2005. Folks that are interested in using this data for their own applications will find the following resources helpful:

  1. mysql> create table moon_phases syntax.
  2. (Perl script to populate the table).
  3. (Perl script to update full moons that are blue).
  4. (sample DBI/DBD/MySQL connection parameters script).
  5. moon_phases.sql.gz (gzip compressed table schema/data dump).
  6. gzip: FreeBSD man page.
  7. gzip: Home page.

See also: the seasons table and data.


Table dcal.moon_phases: Selected data.
mysql> select *
mysql> from dcal.moon_phases
mysql> where year(date)=2005 and month(date)=08;
date phase
4 rows in set (0.0042 seconds)
2005-08-05 New Moon
2005-08-13 First Quarter Moon
2005-08-19 Blue Moon
2005-08-26 Last Quarter Moon

Last updated: Friday, October 31st, 2008 @ 3:15 AM EDT [2008-10-31T07:15:33Z]   home

(c) 2008-2010, Douglas W. Clifton,, all rights reserved.