Template:Moonphasenum
Jump to navigation
Jump to search
0
This template calculates the moon phase as returned by phase_of_the_moon in hacklib.c. The return value is an integer from 0 to 7, with 0 meaning new moon and 4 meaning full moon.
The template takes one optional parameter, time, specifying the time for which the phase should be calculated. For details on valid time formats, see the documentation for the {{#time:}} parser function. The default time is the last time the page was parsed (which might be some time ago due to caching).
Warning: I have not yet tested that the output of this function actually matches phase_of_the_moon in hacklib.c. There might be bugs.
Examples
These were last reparsed at at Fri, 11 Sep 2026 16:00:44 +0000:
- {{moonphasenum}} = 0
- {{moonphasenum|time=yesterday}} = 7
- {{moonphasenum|time=tomorrow}} = 0
- {{moonphasenum|time=+1 week}} = 2
- {{moonphasenum|time=1 January 2010}} = 4
- {{moonphasenum|time=2010-01-01}} = 4