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 nSunSourceIndex.


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.

sBuffer = ''
switch SunEarliesLatestSunrise(n_TokenDate, 1)
    case 1
        sBuffer = 'Earliest sunrise in ' + IntToStr(n_TokenYear)
    case 2
        sBuffer = 'Latest sunrise in ' + IntToStr(n_TokenYear)
switch SunEarliesLatestSunset(n_TokenDate, 1)
    case 1
        sBuffer = 'Earliest sunset in ' + IntToStr(n_TokenYear)
    case 2
        sBuffer = 'Latest sunset in ' + IntToStr(n_TokenYear)

See also: SunEarliestLatestSunrise.


Topic 178540, last updated on 18-Apr-2020