int = PlanetAtMaximumElongation(nDate, nSunSourceIndex, nPlanetID)
This macro function calculates the time, on nDate, when the planet of planetary index nPlanetID is closest to, or furthest away from, the Sun.
•The allowed values for nPlanetID are the 2 inner planets only; n_MERCURY and n_VENUS.
•The sign of the result is positive if the planet is at the maximal eastern elongation, and negative if the planet is at the maximal western elongation, 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_VENUS step 1
sBuffer = ''
nCurResIdx = PlanetAtMaximumElongation(n_TokenDate, 1, nPlanetID)
if nCurResIdx > 0
sBuffer = PlanetName(nPlanetID) + ' at max. elongation east'
if nCurResIdx < 0
sBuffer = PlanetName(nPlanetID) + ' at max. elongation west'
// add the time it occurs in parentheses
if nCurResIdx <> 0
sBuffer = sBuffer + FormatTime('" ("hh:nn")"', Abs(nCurResIdx), true)
See also: PlanetAtExtremalDistanceFromSun and planetary macro functions.
Topic 177605, last updated on 18-Apr-2020