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). This result can then be converted into hours, minutes and seconds, using the functions HoursFromMillion, MinutesFromMillion, and SecondsFromMillion.
•The possible values of nEventIndex are: 1 (sunrise), 2 (sunset), and 3 (upper transit, also called "in the south" in Nordic almanacs).
•If no solar rise, set or transit event of index nEventIndex occurs on nDate, then the function returns -1.
Upper transit is the Sun's passage across the upper meridian of the observer (the meridian passage nearer the zenith). "In the south" is the customary Nordic almanac label for this event. At other locations the transit can be to the north; event index 3 still means upper transit.
The macro code below displays the times of the solar rise, set or transit event of index nEventIndex, on nDate.
sResult = 'Today, the Sun '
nEventTime = SunRiseSetTimeOf(n_TokenDate, 1, 1)
if nEventTime >= 0
sResult = sResult + 'rises at ' + FormatTime('hh:nn', nEventTime, true) + ', '
else
sResult = sResult + 'does not rise, '
endif
nEventTime = SunRiseSetTimeOf(n_TokenDate, 1, 3)
if nEventTime >= 0
sResult = sResult + 'transits at ' + FormatTime('hh:nn', nEventTime, true) + ', '
else
sResult = sResult + 'does not transit, '
endif
nEventTime = SunRiseSetTimeOf(n_TokenDate, 1, 2)
if nEventTime >= 0
sResult = sResult + 'and sets at ' + FormatTime('hh:nn', nEventTime, true) + '.'
else
sResult = sResult + 'and does not set.'
endif
See also: MoonRiseSetTimeOf, HoursFromMillion, MinutesFromMillion, SecondsFromMillion, MillionFromHMS.
Topic 178985, last updated on 12-Jul-2024