The Heavenly Stems and Earthly Branches, referred to as "Stems and Earthly Branches", are the ancient Chinese calendar. Below, we use PHP to implement a Heavenly Stems and Earthly Branches calculator. Friends who need it can refer to it
Heavenly stems and earthly branches, referred to as "stems and branches". In the ancient Chinese calendar, A, B, B, D, Wu, Ji, Geng, Xin, Ren and Gui are called the "Ten Heavenly Stems", while Zi, Chou, Yin, Mao, Chen, Si, Wu, Wei, Shen, You, Xu and Hai are called the "Twelve Earthly Branches". The ten stems and twelve branches match each other in turn to form sixty basic units. The two cooperate with each other in a fixed order to form the stem and branch discipline. Judging from the oracle bone inscriptions unearthed in the Yin Ruins, the heavenly stems and earthly branches were mainly used to record dates in ancient my country. In addition, they were also used to record months, years, and time. Algorithm of Heavenly Stems and Earthly Branches 1 Calculation of Heavenly Stems and Earthly Branches: 1. After AD: Heavenly stems: A 4, B 5, C 6, D 7, Wu 8, Ji 9, Geng 0, Xin 1, Ren 2, Gui 3 For example, if the last number in 1894 is 4, it is year A, and so on. Earthly Branches: Zi 4, Chou 5, Yin 6, Mao 7, Chen 8, Si 9, Noon 10, Wei 11, Shen 0, You 1, Xu 2, Hai 3 Conversion: Divide 1894 by 12, what is the remainder, just find it among the earthly branches 2. BC: Heavenly stems: A 7, B 6, C 5, Ding 4, Wu 3, Ji 2, Geng 1, Xin 0, Ren 9, Gui 8 For example, 7 BC is Year A, and so on. Earthly Branches: Zi-9, Chou-8, Yin-7, Mao-6, Chen-5, Si-4, Wu-3, Wei-2, Shen-1, You-0, Xu-11, Hai-10 Conversion: For example, in 221 BC, -221 was divided by 12. What is the remainder? Find the remainder among the earthly branches. The code is as follows: Algorithm of Heavenly Stems and Earthly Branches 2 The code is as follows: "; } ?>