Somacon.com: Articles on websites & etc.

§ Home > Index > Freeware

Moon Phases for PHP Script (CSV format)

Generate a list of Moon Phase dates and times for any year with this free online tool. The format is CSV, so you can use it in PHP script, Javascript, or any other programming language or database. The data comes directly from the U.S. Naval Observatory Moon Phases Tool.

Moon Phase Generator

Enter a Year
Year must be between 1970 and 2035.
Enter a single year like 2010, or a range like 2010-2015.
Enter a time zone
   

PHP Script

The PHP script to get the moon phases downloads the date/times from the U.S. Naval Observatory Moon Phases Tool. It then parses out the date/times using a regular expression. It converts the date/times from UTC to the selected time zone. Then, it prints the data in multiple formats in a CSV format that can be opened in Excel.

The columns available are:

Developers

Please do not link directly to this data. It is not designed to be high performance and will slow down your application. Download the data and store it in your system.


Created 2011-12-04, Last Modified 2016-12-01, © Shailesh N. Humbad
Disclaimer: This content is provided as-is. The information may be incorrect.