int = PlanetAtExtremalDistanceFromSun(nDate, nSunSourceIndex, nPlanetID)
•The allowed values for nPlanetID range from n_MERCURY to n_PLUTO.
•The sign of the result is positive if the planet is closest, and negative if the planet is furthest away on nDate. If the date nDate does not correspond to either case, then the function returns 0.
•The absolute value of the result is the time of the day expressed in one millionth of a day (less than 1/10th of a second).
The macro code below checks if any of the planets, including Pluto, are closest to the Sun, or furthest from the Sun, on the date of the incoming macro token.
for nPlanetID = n_MERCURY to n_PLUTO step 1
sBuffer = ''
nCurResIdx = PlanetAtExtremalDistanceFromSun(n_TokenDate, 1, nPlanetID)
if nCurResIdx > 0
sBuffer = PlanetName(nPlanetID) + ' is at aphelion'
if nCurResIdx < 0
sBuffer = PlanetName(nPlanetID) + ' is at perihelion'
// add the time it occurs in parentheses
if nCurResIdx <> 0
sBuffer = sBuffer + FormatTime('" ("hh:nn")"', Abs(nCurResIdx), true)
Topic 180005, last updated on 11-Sep-2020