Please enable JavaScript to view this site.

 

int = TithiNumberOf(nWesternDate, nMoonSourceIndex, bSecondTithiIfExists)

 

This macro function returns a value from 1 to 30 corresponding to the lunar day (tithi) of the date nWesternDate, for the Moon data source of index nMoonSourceIndex.

 

You can call this function with bSecondTithiIfExists set to true to check if there are 2 tithis in the same western day nWesternDate (ie. a leap day). This not common, but it does happen a few times a year.

If there are no tithis in the day nWesternDate (ie. an expunged day), then the function returns -1. This not common, but it does happen a few times a year.

 

The macro code below checks if a date is the date of the Deepavali holiday of southern India (there are a few more subtleties in the actual calculation, but the code below gives the gist of it).

nCurTithiNumber = TithiNumberOf(n_TokenDate, 1, false)
nCurTithiTime = TithiTimeOf(n_TokenDate, 1, false)
nCurSunrise = SunRiseSetTimeOf(n_TokenDate, 10)
switch nCurTithiNumber
   case 29
      bIsDeepavali = (nCurSunrise > nCurTithiTime)
   case 30
      bIsDeepavali = (nCurSunrise < nCurTithiTime)
   else
      bIsDeepavali = false
endswitch

See also: TithiTimeOf.

 


Topic 179710, last updated on 18-Apr-2020