Chinese Calendar Algorithm - Year 1901 to 2100 - Version 4.12, by Dr. Herong Yang
The Chinese Calendar Algorithm
This section describes the algorithm to calculate Chinese calendar fields using astronomical data obtained from eleworld.com.
The Chinese calendar is very difficult to calculate. The best algorithm I found on the Internet is the one posted on eleworld.com. This algorithm is based on astronomical data for 200 years from Gregorian year 1901 to year 2100.
The astronomical data has two parts: one part is called Chinese Month Map which can be used for new moon determination, and the other part is called Term Map Set which can be used for solar term determination.
The Chinese Month Map uses 16 bits (2 bytes) for each Gregorian year between 1901 and 2100. The first 4 bits represents an integer indicating the leap month of the year. The rest 12 bits are flags indicating number of days of the corresponding regular month: 1 means 29 days and 0 means 30 days. These 2 bytes are stored in low-high order.
The Term Map Set has 4 tables: Principle Term Map, Principle Term Year, Sectional Term Map, and Sectional Term Year.
A copy of the astronomical data is presented in the Chinese calendar program described in the next section.
Table of Contents