Calculating moon phases accurately is a bit more tricky that it seems.
However, if you don’t need to be extremely precise, you can use the fact that the time from full moon to full moon is 29.53 days or 709 hours average.
If you want to be really accurate, refer to table lookups and additional formulaes.
In my prototype I use only some simple calculations borrowed from this www.nano-reef.com forum entry
I should write some unit tests and verify some random dates against some known moon phase tables.