Navigation:  Macros > Macro Language > Built-in Functions > All Functions (Alphabetical) >


Previous pageReturn to chapter overviewNext page

int = MoonPhaseOf(nDate, nMoonDataSourceIndex, bUseEighths)


This macro function returns a value from 0 to 8 depending on the moon phase that occurs on the date nDate, for the Moon Data Source of position nMoonDataSourceIndex. The parameter bUseEighths specifies if 1/8th phases should be calculated, or only the more common 1/4 phases (left column above). The possible values returned by this function correspond to :



No moon phase of the type specified on nDate.


New Moon


Waxing Crescent


First Quarter


Waxing Gibbous


Full Moon


Waning Gibbous


Last quarter


Waning Crescent


The meaning of the result 0 depends on the value of the parameter bUseEighths.


If bUseEighths is false (the usual case) then a result of 0 means that there is no occurrence of any of the quarter moon phases on the current date, but it is still possible that an eighth phase occurs on nDate, because we specifically told Q++ to ignore the occurrence of eighth phases.


If bUseEighths is true then a result of 0 means that there is no occurrence of any of the quarter moon and no occurrence of any of the eighth phases occurs on nDate.


Some examples :


switch MoonPhaseOf(nDate, 1, false)

 case 0

         sRESULT = 'No moon phase on ' + FormatDate('c', nDate)

 case 1

         sRESULT = 'New moon on ' + FormatDate('c', nDate)

 case 3

         sRESULT = 'First quarter on ' + FormatDate('c', nDate)

 case 5

         sRESULT = 'Full moon on ' + FormatDate('c', nDate)

 case 7

         sRESULT = 'Last quarter on ' + FormatDate('c', nDate)



Note that the result of this function are affected by the Moon Source you have selected for the current script. To calculate and display the time when a Moon phase occurs, use the function MoonPhaseAndTimeOf.

Topic 110076 updated on 27-Jun-05.
Topic URL: