int = PlanetInSolarConjunctionOrOpposition(nDate, nSunSourceIndex, nPlanetID)
This macro function returns the type and time of a conjunction, opposition, quadrature or trine between the planet specified by nPlanetID and the Sun on nDate. These names describe alignments in geocentric ecliptic longitude, measured as seen from the center of the Earth.
A conjunction means equal ecliptic longitude; an opposition means a difference of 180°; quadrature means a difference of +90° or -90°; and a trine means a difference of +120° or -120°. These are longitude relationships, not measurements of full angular separation. In particular, a conjunction does not imply that the bodies overlap on the sky or are at their closest approach.
Use a calculated Sun data source, selected by nSunSourceIndex. Dates and returned times use that source's local-time settings. The event is geocentric (as seen from the center of the Earth): the observer's position on Earth does not change its instant, although the local date and time can differ between sources. The function does not require the bodies to be above the local horizon or visible.
➢The allowed values for nPlanetID range from n_MERCURY to n_PLUTO.
If no event occurs on nDate, the function returns 0. Otherwise, the result combines the event index and its time: event index × 1000000 + time in millionths of a day. Use div 1000000 to extract the event index and mod 1000000 to extract the time.
Event Index |
Event |
1 |
Lower Conjunction (only for Mercury and Venus) |
2 |
Upper Conjunction (only for Mercury and Venus) |
3 |
Conjunction |
4 |
Opposition |
5 |
Eastern quadrature |
6 |
Western quadrature |
7 |
Trine |
Example
These return-value codes differ from the IDs accepted by PlanetaryEvent and PlanetaryEventSymbol. See the correspondence table in PlanetsInConjunctionOrOpposition. There are no corresponding named constants for quadrature or trine; use suitable text for those events, as in the example below.
The macro code below checks whether any of the planets from Mercury to Pluto is in conjunction, opposition, quadrature or trine with the Sun on the date of the incoming macro token.
sResult = ''
for nPl1 = n_MERCURY to n_PLUTO step 1
sBuffer = ''
nCurResIdx = PlanetInSolarConjunctionOrOpposition(n_TokenDate, 1, nPl1)
switch (nCurResIdx div 1000000)
case 1
sBuffer = PlanetName(nPl1) + ' in ' + PlanetaryEvent(n_LOWER_CONJ)
case 2
sBuffer = PlanetName(nPl1) + ' in ' + PlanetaryEvent(n_UPPER_CONJ)
case 3
sBuffer = PlanetName(nPl1) + ' in ' + PlanetaryEvent(n_CONJUNCTION)
case 4
sBuffer = PlanetName(nPl1) + ' in ' + PlanetaryEvent(n_OPPOSITION)
case 5
sBuffer = PlanetName(nPl1) + ' in eastern quadrature'
case 6
sBuffer = PlanetName(nPl1) + ' in western quadrature'
case 7
sBuffer = PlanetName(nPl1) + ' trine'
endswitch
// add the time it occurs in parentheses
if nCurResIdx <> 0
sBuffer = sBuffer + FormatTime('" ("hh:nn")"', nCurResIdx mod 1000000, true)
endif
if sBuffer <> ''
if sResult <> ''
sResult = sResult + ', '
endif
sResult = sResult + sBuffer
endif
endfor
One millionth of a day represents 0.0864 seconds in the time encoding; this specifies the units, not a guarantee of sub-second calculation accuracy.
See also: PlanetAtExtremalDistanceFromSun and planetary macro functions.
Topic 177620, last updated on 12-Oct-2026