Please enable JavaScript to view this site.

 

int = SunEarliestLatestSunset(nDate, nSunDataSourceIndex)

 

This macro function checks if the date nDate corresponds to the earliest or latest sunset of the year, based on the observer position corresponding to the Sun data source of index nSunDataSourceIndex.

 

•The result is 1 for the earliest sunset of the year and 2 for the latest sunset of the year.

•If nDate does not correspond to the latest or earliest sunset 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: SunEarliestLatestSunrise.

 


Topic 178540, last updated on 11-Oct-2026