int = SunLongitudeAngle(nDate, nTimeOfDay, nSunDataSourceIndex, bTopocentric)
This macro function returns the Sun's longitude angle on the date nDate at nTimeOfDay for the Sun data source of position nSunDataSourceIndex.
➢The function returns the Sun’s longitude angle multiplied by 10000, with any remaining fractional part discarded. For example, a result of 2782548 means 278.2548 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 longitude is calculated geocentrically, as viewed from the center of the Earth. The Sun data source supplies the time-zone information used to interpret nDate and nTimeOfDay. The parameter bTopocentric is ignored; passing true or false produces the same result.
The macro code below checks if the Sun enters a new Zodiac sign on nRunDate and which one it is.
nAt2359 = MillionFromHMS(23,59,59)
nLongitude = SunLongitudeAngle(nRunDate-1, nAt2359, 1, true)
nPreviousZodiacIndex = 1 + (nLongitude div 300000)
nLongitude = SunLongitudeAngle(nRunDate, nAt2359, 1, true)
nCurrentZodiacIndex = 1 + (nLongitude div 300000)
if nCurrentZodiacIndex <> nPreviousZodiacIndex
sResult = 'Sun enters ' + ZodiacName(nCurrentZodiacIndex)
else
sResult = ''
endif
See also: ZodiacName, ZodiacSignAndTimeOf, ZodiacSignOf, ZodiacSymbol, MoonLongitudeAngle.
Topic 179990, last updated on 11-Oct-2026