Example of how to implement the daily support calculator using php

Source: Internet
Author: User
Tiangan Land support, or "Ganzhi" for short, is an ancient Chinese calendar. The following uses php to implement a tiangan Land support calculator. For more information, see

Tiangan Land support, or "Ganzhi" for short, is an ancient Chinese calendar. The following uses php to implement a tiangan Land support calculator. For more information, see

Tiangan Land support, referred to as "Ganzhi ". 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 the twelve branches match in sequence and form 60 basic units. The two work together in a fixed order and form the dry trunk discipline. 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
";
}
?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.