int = SolarEclipseOnDate(nDate, nSunDataSourceIndex)
This macro function calculates the type and time of the solar eclipse, as seen from any location on Earth, on nDate, using the Sun data source of index nSunDataSourceIndex.
When an eclipse is found, the result combines its type index and time: eclipse type index × 1000000 + time in millionths of a day. One millionth of a day is less than 1/10th of a second. Use div 1000000 to extract the type index and mod 1000000 to extract the time.
If no solar eclipse occurs on nDate, then the function returns -1.
Example
To separate the type of eclipse from the time, use the div and mod operators on the returned result, as shown in the code below.
nComboResult = SolarEclipseOnDate(n_TokenDate, 1)
if nComboResult >= 0
nEclipseType = nComboResult div 1000000
sEclipseTypeName = SolarEclipseTypeName(nEclipseType)
nEclipseTime = nComboResult mod 1000000
sEclipseTime = FormatTime('hh:nn', nEclipseTime, true)
sResult = sEclipseTypeName + ' solar eclipse at ' + sEclipseTime
else
sResult = 'No solar eclipse today'
endif
See also: LunarEclipseOnDate, SolarEclipsePositionMax, SolarEclipsePositionName, SolarEclipseTypeName, Solar Eclipse Types.
Topic 180030, last updated on 11-Oct-2026