Please enable JavaScript to view this site.


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 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 nSunDataSourceIndex, otherwise that parameter is only used for the timezone information.


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 10000
nLongitude = SunLongitudeAngle(nRunDate, nAt2359, 1, true)
nCurrentZodiacIndex = 1 + (nLongitude div 10000
if nCurrentZodiacIndex <> nPreviousZodiacIndex
   sResult = 'Sun enters' + ZodiacName(nCurrentZodiacIndex)
   sResult = ''

See also: ZodiacName, ZodiacSignAndTimeOf, ZodiacSignOf, ZodiacSymbol, MoonLongitudeAngle.


Topic 179990, last updated on 18-Apr-2020