int = SunEarliestLatestSunrise(nDate, nSunDataSourceIndex)
This macro function checks if the date nDate corresponds to the earliest or latest sunrise of the year, based on the observer position corresponding to the Sun data source of index nSunDataSourceIndex.
•The result is 1 for the earliest sunrise of the year and 2 for the latest sunrise of the year.
•If nDate does not correspond to the latest or earliest sunrise of the year, then the function returns 0.
The macro code below displays which of the earliest/latest sunrise/sunsets occur on nDate, if any.
sResult = ''
switch SunEarliestLatestSunrise(n_TokenDate, 1)
case 1
sResult = 'Earliest sunrise in ' + IntToStr(n_TokenYear)
case 2
sResult = 'Latest sunrise in ' + IntToStr(n_TokenYear)
endswitch
sBuffer = ''
switch SunEarliestLatestSunset(n_TokenDate, 1)
case 1
sBuffer = 'Earliest sunset in ' + IntToStr(n_TokenYear)
case 2
sBuffer = 'Latest sunset in ' + IntToStr(n_TokenYear)
endswitch
if sBuffer <> ''
if sResult <> ''
sResult = sResult + ', '
endif
sResult = sResult + sBuffer
endif
See also: SunEarliestLatestSunset.
Topic 178535, last updated on 11-Oct-2026