Happy Chinese new year of the dragon! Do you know why China has its own calendar? Do you know why this year is the year of the dragon? Many doubts? Do you want to know the reason? Keep reading this text, you may clear your mind!

Chinese Calendar is one of the oldest calendar in the world. Because of agricultural needs, many early civilizations like Ancient Egypt, Ancient Babylon has their own calendar, but almost all disappeared with its civilizations.
When ancient China made its own calendar, they should think of the three circles: They are the cycle of day and night, the cycle of moon phases (lunar cycle) and the cycle of seasons (solar cycle). In other ancient countries, for convenience, some only think about the cycle of moon phases (lunar cycle), that's lunar calendar, the classical calendar of lunar calendar is Islamic calendar. Some only think about the cycle of seasons (solar cycle), that's called solar calendar. The classical solar calendar is Gregorian calendar, which is widely used in the world. It also belongs to religious calendar, Christianity calendar. The clever Chinese consider all circles, that is the lunisolar calendar. Jews also use lunisolar calendar, but the rules are totally different. So, west people said Chinese calendar is a kind of lunar calendar. This is a wrong idea.
In Chinese calendar, the first day of a month is determined by the day of the lunar conjunction (new moon). Since the synodic month is 29.5306 days, a Chinese month can have 29 days (short month) or 30 days (long month), depending on the number of days between the dates of two successive new moons. One tropical year has 365.2422 days. Therefore, there are on average 12.37 Chinese months in a tropical year. A Chinese year normally has 12 months. To keep the calendar in sync with seasons, an extra month has to be inserted in the year about every 3 years, in which case there are 13 months in the year. This extra month is called a leap (intercalary) month.
The modern China calendar determines the name of the year based on the corresponding cycles of 10 heavenly stems (甲、乙、丙、丁、戊、己、庚、辛、壬、癸) and 12 earthly branches (子、丑、寅、卯、辰、巳、午、未、申、酉、戌、亥). This is completely different from the Gregorian calendar, which uses numbers to count years. The month corresponds to the cycle of the moon around the earth and has the characteristics of the lunar calendar. In order to ensure that the farming season is not missed, there are 7 extra months every 13 years in the year cycle. The extra months in each leap year are not fixed. Together with the 12 solar terms that are almost fixed on the Gregorian calendar, it can perfectly display the cycle law of the sun. Characteristics of the Gregorian calendar.
In 1912, the Republic of China was founded in Nanjing, They adopted the Republic of China calendar system based by Gregorian calendar. The difference is only in the year's name. In 1949, the People's Republic of China founded and the Republic of China became the local regime in Taiwan island, so Taiwan keeps the Republic of China calendar system while other Chinese lands are all used Gregorian calendar, totally same with the world. The China calendar is only used on festivals and has lost its practical significance. However, the China calendar is actually no less effective than the Gregorian calendar in guiding agricultural production and life.
If you are more interested in astronomy and China calendar, you could go to this GitHub page: https://ytliu0.github.io/ChineseCalendar/rules.html.
So the key question we cared about most, how do we transform Gregorian calendar into China calendar? When is the next date of Chinese new year, so that we could have fun?
1. Calculate in Microsoft Excel
For most people without coding experience, we could use Microsoft Excel to calculate:
=MID("甲乙丙丁戊己庚辛壬癸",MOD(TEXT(C3,"[$-130000]e")-4,10)+1,1)&MID("子丑寅卯辰巳午未申酉戌亥",MOD(TEXT(C3,"[$-130000]e")-4,12)+1,1)&"年"&TEXT(C3,"[$-130000][DBNum1]m月d日")
In this Excel function, TEXT(C2, "[$-130000]e"): This part formats the value in cell C2 into text format, using a special format code "[$-130000]e". [$-130000]e is a special date conversion format.
MOD(TEXT(C2, "[$-130000]e")-4, 10) + 1: This part subtracts 4 from the value in C2, then modulo 10, and adds 1. This will ensure the result is between 1 and 10.
MID("甲乙丙丁戊己庚辛壬癸",MOD(TEXT(C3,"[$-130000]e")-4,10)+1,1): This function is used to extract a character from the specified string. Here, the first parameter is a string containing the name of the heavenly stem. The second parameter is a number representing the character position to be extracted from the string.MID("子丑寅卯辰巳午未申酉戌亥",MOD(TEXT(C3,"[$-130000]e")-4,12)+1,1) has the similar meaning.
TEXT(C3,"[$-130000][DBNum1]m月d日") make the later part of "month" and "day".
To easy to valuate, you should understand 12th, May 2014 should be 2014年5月12日. First, you should translate into Chinese date and then transform the date in Chinese calendar.
Let us try: 29th. November 2035 should be 乙卯年十月三十日.

2. Calculate in Python,JavaScript and in Rust
You can use the library for easier to transform:
#Python:
import datetime
import lunarcalendar
def convert_to_lunar(year, month, day):
cal = lunarcalendar.Lunar(year, month, day)
return cal.to_string()
today = datetime.date(2024, 2, 12)
lunar_date = convert_to_lunar(today.year, today.month, today.day)
print("农历日期:", lunar_date)
//Rust:
use chinese_calendar::{ChineseDate, ChineseLeapMonthMode, Date};
fn main() {
let today = Date::from_gregorian(2024, 2, 12);
let lunar_date = today.to_chinese();
println!("农历日期: {}", lunar_date);
}
//Javascript:
const lunarCalendar = require('lunar-calendar');
const today = new Date(2024, 1, 12); // JavaScript 的月份从 0 开始,所以 1 代表二月
const lunarDate = lunarCalendar.solarToLunar(today);
console.log("农历日期:", lunarDate.lunarYear, "年", lunarDate.lunarMonth, "月", lunarDate.lunarDay, "日");
The last question. How do I know the year of zodiac sign? That's easy. If you know the name of this year, you will know the zodiac sign.
Here is the table:
子-鼠-mouse
丑-牛-ox
寅-虎-tiger
卯-兔-rabbit
辰-龙-dragon
巳-蛇-snake
午-马-horse
未-羊-sheep/goat
申-猴-monkey
酉-鸡-chook
戌-狗-dog
亥-猪-pig
For example, today is 2024-2-12, so the date in China calendar is 甲辰年1月3日. Because 辰 is dragon. the year of 2024 should be the year of dragon.
So you know all the reason now?