Moon Phase Widget

Method 1 : Displaying the current phase
Put this code in to your html file's body..

Method 2 : Displaying the phase for a specific date
You can pass variables to the php page through the iframe. This method can be used to display a phase in an iframe for a specific date.

The format for passing variables is as follows:

This example show the phase inside an iframe for the date 27th Jan 2012.

Method 3 : Displaying the phase for a specific date
This method is used to display the phase in a browser window (no iframe). Click the link to see the moon phase in a new window.

ex :

To show the current phase just drop the variables in the url righ after ".php".

The Joomla module
if you're putting this on your joomla site you may find it impossible to embed the above code. Use the Joomla module instead.

Moon Phase Joomla Module - (2kb)

Acuracy: The phase of the moon is calculated using simple mathematics. This widget is still in beta stage so if you find any errors please report them to me by email : admin[at] (relace [at] with @)

How it works : The widget is made with php. So you don't need flash or anything installed for this to work. However the widget will not work offline. You need to have internet connected for this to work.

Changing the iframe size: The above code already contains proper i frame width and height. Changing this values may result the widget to align incorrectly. Always use the above settings.

If you encounter bugs or if you have any ideas to improve this contact me .. email : admin[at]


Anuradha Jayathilaka (Colombo, Sri Lanka)

2010 © All rights reserved.

Current moon phase


Moon phase for 2012/1/27

The code is on github . Please put your issues there and i'll try to fix them asap.