Navigation:  Macros > Macro Language > Built-in Functions > All Functions (Alphabetical) >


Previous pageReturn to chapter overviewNext page

int = chDate1InYear(chDay, chMonth, nYear)

int = chDate2InYear(chDay, chMonth, nYear)


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


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


 nChNewYear = chDate1InYear(1, 1, 2005)


There are 2 functions because the Chinese calendar is not exactly aligned with the Gregorian, 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.


 bTwoOccurences = (chDate2InYear(aChDay, aChMonth, aYear) > 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 possibly Chinese dates in your macros, you should always check for multiple occurences.


See also : Chinese Dates Functions.

Topic 160600 updated on 18-Apr-2004.
Topic URL: