Please enable JavaScript to view this site.

 

int = SunRiseSetTimeOf(nDate, nSunSourceIndex, nEventIndex)

 

This macro function calculates the time of the solar rise, set or transit event of index nEventIndex, on nDate, based on the observer position corresponding to the Sun data source of index nSunSourceIndex.

 

The result is the time of the day expressed in one millionth of a day (less than 1/10th of a second).

The possible values of nEventIndex are: 0 (sunrise), 1 (sunset), and 2 (upper transit, aka. in the south).

If no solar rise, set or transit event of index nEventIndex occurs on nDate, then the function returns -1.

 

The macro code below displays the times of the solar rise, set or transit event of index nEventIndex, on nDate.

sResult = ''
nEventTime = SunRiseSetTimeOf(n_TokenDate, 10)
if nEventTime >= 0
   sResult = 'Today, the Sun rises at ' + FormatTime('hh:nn', nEventTime, true) + ', '
else
   sResult = 'Today, the Sun does not rise, '
endif
nEventTime = SunRiseSetTimeOf(n_TokenDate, 12)
if nEventTime >= 0
   sResult = sResult + 'transits at ' + FormatTime('hh:nn', nEventTime, true) + ', '
else
   sResult = sResult + 'does not transit, '
endif
nEventTime = SunRiseSetTimeOf(n_TokenDate, 11)
if nEventTime >= 0
   sResult = sResult + 'and sets at ' + FormatTime('hh:nn', nEventTime, true) + '.'
else
   sResult = sResult + 'and does not set.'
endif

See also: MoonRiseSetTimeOf.

 


Topic 178985, last updated on 18-Apr-2020