int = PlanetInConjunctionOrOpposition(nDate, nSunSourceIndex, nPlanet1, nPlanet2)
This macro function calculates the time, on nDate, when the 2 bodies of planetary index nPlanetID are in conjunction, in opposition or in quadrature with the Earth, or trine to the Earth, with respect to each other.
•The allowed values for nPlanetID range from n_MOON to n_PLUTO.
•The result is the time of the day expressed in one millionth of a day (less than 1/10th of a second), plus 1 million times the index of the conjunction or opposition occurring on nDate. If no event occurs on nDate, then the function returns 0.
The macro code below checks if any of the planets is in conjunction, in opposition or in quadrature, on the date of the incoming macro token.
for nPl1 = n_MERCURY to n_PLUTO step 1
sBuffer = ''
nCurResIdx = PlanetsInConjunctionOrOpposition(n_TokenDate, 1, nPl1, nPl2)
switch (nCurResIdx div 1000000)
case 1
sBuffer = PlanetName(nPl1) + PlanetName(nPl2) + ' in ' + PlanetaryEvent(n_LOWER_CONJ)
case 2
sBuffer = PlanetName(nPl1) + PlanetName(nPl2) + ' in ' + PlanetaryEvent(n_UPPER_CONJ)
case 3
sBuffer = PlanetName(nPl1) + PlanetName(nPl2) + ' in ' + PlanetaryEvent(n_CONJUNCTION)
case 4
sBuffer = PlanetName(nPl1) + PlanetName(nPl2) + ' in ' + PlanetaryEvent(n_OPPOSITION)
case 5
sBuffer = PlanetName(nPl1) + PlanetName(nPl2) + ' in eastern quadrature'
case 6
sBuffer = PlanetName(nPl1) + PlanetName(nPl2) + ' in western quadrature'
endswitch
// add the time it occurs in parentheses
if nCurResIdx <> 0
sBuffer = sBuffer + FormatTime('" ("hh:nn")"', nCurResIdx mod 1000000, true)
endif
endfor
See also: PlanetAtExtremalDistanceFromSun and planetary macro functions.
Topic 188970, last updated on 08-Apr-2026