Please enable JavaScript to view this site.

 

int = chDate1InYear(chDay, chMonth, nWesternYear)

int = chDate2InYear(chDay, chMonth, nWesternYear)

 

These macro functions return the first and, eventually, second date on which a Chinese lunar date (day and month of the lunar calendar) occurs for the western year nWesternYear.

 

For example, to calculate the date of Chinese New Year in 2020 :

// western date of Chinese New Year in 2020
nChNewYear = chDate1InYear(112020)

There are 2 functions because the Chinese calendar is not exactly aligned with the western calendar and therefore a given Chinese date may occur more than once in a Gregorian year.

 

To determine if a given Chinese day-month pair occurs more than once in a year, you need to see if the value of chDate2InYear is larger than 0.

// check if Chinese lunar date occurs twice in a western year
nFirstDate = chDate1InYear(1122020)
nSecondDate = chDate2InYear(1122020)
bTwoOccurences = (nSecondDate > 0)

In practice, this concerns only Chinese dates which fall around January 1st, which fortunately does not correspond to any of the major Chinese lunar holidays. But if you are evaluating Chinese dates which fall near the beginning of the 12th month of the Chinese lunar calendar, then you should always check for multiple occurrences.

 

See also: Chinese Dates Functions.

 


Topic 160600, last updated on 18-Apr-2020