Celestial Programming : Moon Age

This returns the age of the moon in days since the new moon. This is a simplistic method based on the average days in a lunar month. A more accurate method could be obtained by replacing 2451550.1 with a computed new moon date near the desired date.