Tiangan land support, or "Ganzhi" for short, is a calendar in ancient China. the following uses php to implement a Tiangan land Support Calculator. if you need it, you can refer to the following Tiangan land support, or "Ganzhi" for short ". In the ancient Chinese calendar, a, B, c, Ding, E, Ji, Geng, Xin, Yi, and Xi are called "ten-day dry ", sub-, ugly, Yin, Mao, Chen, Si, Wu, Wei, Shen, you, Yao, and Hai are called "12 Dizhi ". The ten-trunk and twelve-trunk match in sequence and form 60 basic units. The two work together in a fixed order to form the Dry Branch law. From the Oracle unearthed from the Yin dynasty, Tiangan land support was mainly used for Ji-sun in ancient China, and also used for Ji-yue, Ji-nian, Ji-shi, and so on.
Tiangan geographic support Algorithm 1
Tiangan geographic support algorithm:
1. post-ad:
Tiangan: Jia 4 B 5 c 6 Ding 7 E 8 ji 9 Geng 0 Xin 1 Yi 2 Xi 3
For example, if the number at the end of 1894 is 4, it will be a year, and so on.
Dizhi: son 4 ugly 5 Yin 6 Mao 7 Chen 8 Si 9 Wu 10 not 11 Shen 0 1 Jun 2 Hai 3
Conversion: 1894 divided by 12. if the remainder is a few, you can find the remainder in the local branch.
II. BC:
Tiangan: A 7 B 6 c 5 D 4 e 3 have 2G 1 Xin 0 Shen 9 XI 8
For example, 7 BC is like year.
Dizhi: Sub-9 ugly-8 Yin-7 Mao-6 Chen-5 Si-4 Wu-3 not-2 Shen-1 0 Qin-11 Hai-10
Conversion: for example, in January 1, 221 BC,-221 divided by 12. if the remainder is a few, find the remainder in the local branch.
The code is as follows:
$ TGDZ = array ('A', 'B', 'Bing', 'ding', 'pente', 'Ji ', 'geng', 'sin ', 'authorization', 'authorization '),
Array ('child ', 'Ugly', 'yin ', 'Mao', 'Chen ', 'Si', 'Wu ', 'Wei', 'Shen ', 'uni', 'Shanghai', 'Hai '));
$ Year = 2014;
$ Year_JiSuan = $ Year-1900 + 36;
$ TianGanDiZhi = $ TGDZ [0] [$ Year_JiSuan % 10]. $ TGDZ [1] [$ Year_JiSuan % 12];
Echo $ Year. "Year is the lunar calendar [". $ TianGanDiZhi. "] Year ";
?>
Tiangan geographic support Algorithm 2
The code is as follows:
$ TGDZ = array ('geng ', 'sin', 'Taobao', 'dece', 'A',' B ', 'Bing', 'ding ', 'pente', 'Ji '), array ('Shen', 'you', 'Ji ', 'hai', 'sub ', 'ug', 'yin ', 'Mao ', 'Chen', 'Si ', 'Wu', 'Wei '));
For ($ Year = 1900; $ Year <= 2099; $ Year ++)
{
$ TianGanDiZhi = $ TGDZ [0] [$ Year % 10]. $ TGDZ [1] [$ Year % 12];
Echo $ Year. "Year is the lunar calendar [". $ TianGanDiZhi. "] Year
";
}
?>