Please enable JavaScript to view this site.


int = SunLongestShortestDay(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 nSunSourceIndex.


The result is 1 for the shortest day of the year and 2 for the longest day of the year.

The length of the day is defined as the time between sunrise and sunset. on nDate.

If nDate does not correspond to the shortest or longest day 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 SunLongestShortestDay(n_TokenDate, 1)
    case 1
        sBuffer = 'Summer is coming ... in about 6 months'
    case 2
        sBuffer = 'Winter is coming ... in about 6 months'

See also: SunEarliestLatestSunrise, SunEarliestLatestSunset.


Topic 178545, last updated on 18-Apr-2020