bool = SunIsUp(nDate, nTimeOfDay, nSunDataSourceIndex)
This macro function checks if the Sun has risen (and not yet set) on the date nDate at nTimeOfDay for the Sun data source of position nSunDataSourceIndex.
➢The parameter nTimeOfDay should be supplied in one millionth of a day (less than 1/10th of a second), using the function MillionFromHMS to avoid any error.
The macro code below checks if the Sun was up 5 minutes before moonset on the 29th day of the month of Ramadan, to determine (in Saudi Arabia and many other countries), if the next day will be the first day of the month of Shawal, also known as the End of Ramadan.
// get the current islamic year
nIslamicYear = iYearOf(n_TokenDate)
// when is the 29th of Ramadan ?
nRamadan29 = EncodeMuslimDate(nIslamicYear,9,29)
// when does the Moon set on that day ?
nTimeMoonset = MoonRiseSetTimeOf(nRamadan29,1,1)
// check if the Sun was still up 5 minutes before
nTimeThreshold = nTimeMoonset - MillionFromHMS(0,5,0)
sResult = 'Tomorrow is the 30th of Ramadan'
sResult = 'Tomorrow is the the feast of the End of Ramadan'
Note that the function SunIsUp uses the apparent position of the Sun, which takes into account atmospheric refraction, and therefore is closest to what a human observer would see.
See also: SunEarliestLatestSunrise, SunEarliestLatestSunset, SunRiseSetTimeOf.
Topic 179960, last updated on 18-Apr-2020