Please enable JavaScript to view this site.


int = TithiTimeOf(nWesternDate, nMoonSourceIndex, bSecondTithiIfExists)


This macro function returns the time when the lunar day (tithi) begins on the date nWesternDate, for the Moon data source of index nMoonSourceIndex.


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

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)
      bIsDeepavali = false

See also: TithiNumberOf.