Please enable JavaScript to view this site.


int = MoonLongitudeAngle(nDate, nTimeOfDay, nMoonDataSourceIndex, bTopocentric)


This macro function returns the Moon's longitude angle on the date nDate at nTimeOfDay for the moon data source of position nMoonDataSourceIndex.


The function returns 10000 times the longitude angle (a result of 27825486 would mean 278.25486 degrees).

The parameter nTimeOfDay should be supplied in one millionth of a day (less than 1/10th of a second), using the function MillionFromHMS to avoid any error.

The parameter bTopocentric determines if the calculation is based on the position of the observer for nMoonDataSourceIndex, otherwise that parameter is only used for the timezone information.


The macro code below checks if the Moon enters a new Zodiac sign on nRunDate and which one it is.

nAt2359 = MillionFromHMS(23,59,59)
nLongitude = MoonLongitudeAngle(nRunDate-1, nAt2359, 1, true)
nPreviousZodiacIndex = 1 + (nLongitude div 10000
nLongitude = MoonLongitudeAngle(nRunDate, nAt2359, 1, true)
nCurrentZodiacIndex = 1 + (nLongitude div 10000
if nCurrentZodiacIndex <> nPreviousZodiacIndex
   sResult = 'Moon enters' + ZodiacName(nCurrentZodiacIndex)
   sResult = ''

The macro code below checks the status of the Moon and Sun on nRunDate and this information is then used in one of the best day for an activity functions.

nAt2359 = MillionFromHMS(23,59,59)
nLongitude = MoonLongitudeAngle(nRunDate, nAt2359, nIdxSrcZodiac, true)
nZodiac = MoonZodiacSignOf(nRunDate, nAt2359, true, nIdxSrcZodiac) - 1
nMoonPhase = MoonPhaseOf(nRunDate, nIdxSrcPhases, true)
bNewMoon = (nMoonPhase == 1)
bFullMoon = (nMoonPhase == 5)
bIsFirstQuarterDay = (nMoonPhase == 3)
bViertel = (nMoonPhase in [3,7])
nPhase = MoonPhaseAngle(nRunDate, nAt2359, nIdxSrcPhases)
bIn1stQuarter = (nPhase in [      0 ..  899999])
bIn2ndQuarter = (nPhase in [ 900000 .. 1799999])
bIn3rdQuarter = (nPhase in [1800000 .. 2699999])
bIn4thQuarter = (nPhase in [2700000 .. 3599999])
bIncreasingMoon = bIn1stQuarter or bIn2ndQuarter
bDecreasingMoon = bIn3rdQuarter or bIn4thQuarter
if GoodDayFor(sCurActivity)
    if sResult <> ''
        sResult = sResult + ', '
    sResult = sResult + IntToStr(DayOf(nRunDate))

The function MoonLongitudeAngle calculated on a loop of the days of the year, could be used to calculate the result of MoonZodiacSignOf (in a much less convenient manner, though).


See also: MoonZodiacSignOf, MoonPhaseAngle, TithiNumberOf, TithiTimeOf.


Topic 179850, last updated on 18-Apr-2020