int = chDate1InYear(nchDay, nchMonth, nWesternYear)
int = chDate2InYear(nchDay, nchMonth, nWesternYear)
These macro functions return the first and, if present, second occurrence of the specified Chinese lunar day and month within the Gregorian year nWesternYear.
Both functions search only regular Chinese lunar months. They do not include dates in a leap month of the same number. A second occurrence arises when the specified regular-month date occurs in two different Chinese years within the same Gregorian year.
•chDate1InYear returns −1 if no matching date occurs in the specified Gregorian year.
•chDate2InYear returns −1 if there is no second occurrence.
For example, to calculate the date of Chinese New Year in 2020 :
// western date of Chinese New Year in 2020
nChNewYear = chDate1InYear(1, 1, 2020)
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(1, 12, 2020)
nSecondDate = chDate2InYear(1, 12, 2020)
bTwoOccurrences = (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 10-Oct-2026