Please enable JavaScript to view this site.


int = chMonthOf(nWesternDate)


This macro function returns the lunar month number of the Chinese date corresponding to the date nWesternDate (possible values range from 1-12).


This function can be used to mimic the [chm] and [chmm] tokens, as in the macro below.

// manually calculate the tokens [chm] and [chmm]
nLunarMonth = chMonthOf(n_TokenDate)
// convert lunar month number to Chinese characters
sChLunarMonth = IntToStrChinese(nLunarMonth)
if chIsLeapMonth(n_TokenDate)
   sChLunarMonth = '闰' + sChLunarMonth
// display the result on 2 separate lines
sResult = '[chm] is ' + sChLunarMonth
sResult = sResult + chr(13)
sResult = sResult + '[chmm] is ' + sChLunarMonth + '月'

Care must be taken, using the chIsLeapMonth function, to check if the current month is the normal month or a leap month of the same number.


See also: chinese dates functions.


Topic 160100, last updated on 18-Apr-2020