In fact, the Chinese lunar calendar is used Ganzhi, "Ganzhi" that is, 10 days dry with 12 earthly branches.
10 days for: A, B, C, Ding, E, self, Geng, Xin, Ren, GUI.
12 Earthly Branches for: son, Ugly, Yin, Mao, Chen, have, noon, not, Shen, unitary, Xu, Hai.
The meaning of the 10-day dry is as follows:
A------the grass begins to sprout.
B-the beginning of vegetation, that is, "rolling", the process is full of hardships, as is rolled up in general, this process is the most test of the tenacity of life.
C--"Bing", the vegetation to get enough sunshine to grow.
Ding-the sun is full of water, and vegetation thrives, like a strong young man (jizya).
e-building blocks into forests, wooded.
Self--"Ji", refers to the beginning of the trees are known, can be identified.
Geng-that is, "more", updated, from now on the vegetation will reproduce the next generation, endless.
Xin--tasted the sweetness of the harvest.
The siren--"pregnancy", breeds offspring.
GUI--"Coyett". Live and die, the dead, the cycle.
12 meaning of the earthly branches:
Son--Daosh one, life two.
Ugly-that is, "new", Yin and yang two-qi desire to fit the potential.
Yin-Sansheng All things, the first length of vegetation.
Mao-The "Mau", lush vegetation.
Chen--"earthquake". "Yi" by the "Earthquake Gua", life because of the germination of birth.
Yin Qi is contained in Yang Qi. The growth of vegetation is good, a flourishing scene. will be the pinnacle of life.
Afternoon-success in business, on the success of life.
Not-that is, "taste", on top of the cause, tasted the taste of fame.
Shen-sheng. At this time to be careful, Prince have regrets, Sheng will go to decline after the pole, Tai no come.
Unitary-old, enter the old age, this time should begin to accumulate life.
Xu-that is, "extinguish". Death, everything to nothingness.
Hai-namely "nuclear". New seeds are about to sprout and a new life will be opened.
Whether it is 10 days dry, or 12 earthly branches, it boils down to: sickness and death.
Under the System.Globalization namespace, a calendar management class Eastasianlunisolarcalendar based on Oriental culture is provided, which can be used for calendar operations in eastern countries such as China, Japan, and North Korea.
To obtain information about the Chinese lunar calendar, you can use the Chineselunisolarcalendar class. Call the GetYear method to get the lunar year for the specified Gregorian date, and the GetMonth method returns the lunar month for the month in the Gregorian date. Of course, you can also use the Isleapyear or Isleapmonth method to determine whether a year is a leap/leap month.
Here we're going to get the ganzhi of the year, and you can call the Getsexagenaryyear method, which returns a value from 1 to 60 that represents the order in the Ganzhi. The front old week spoke of 10 days of dry and 12 earthly branches of the inclusion. The Ganzhi is the combination of 10-day dry and 12-terrestrial branches in sequence. For example, a Zodiac, and a sub-group in the earthly branches, for the Koshien, and so on, Yi Yi, C Yin ...
This combination goes on to produce 60 pairs of combinations, that is, every 60 of them, so that each of the years is 60 years apart and then recycled.
Since these APIs return numeric values, to represent them as Chinese characters, we can declare enumeration types for Zodiac and earthly branches, respectively.
enum Zodiac { 1, B, C, Ding, e, self , g, Xin, Ren, decyl } enum earthly { 1, ugly, Yin, Mao, Chen, Noon, No, Shen, unitary, xu, hai }
You only need to mark the first member of each enumeration as 1, and then it will automatically increment, such as B is 2, C is 3 ...
The following code shows how to get the Ganzhi calendar.
Chineselunisolarcalendar cncal =NewChineselunisolarcalendar (); //get lunar year inty =cncal. GetYear (seldate); Year. Text=y.tostring (); //get Ganzhi Calendar value intA =cncal. Getsexagenaryyear (seldate); //access to Zodiac, earthlyZodiac TG =(zodiac) cncal. Getcelestialstem (a); Earthly DZ=(earthly) cncal. Getterrestrialbranch (a); stringmsg = $"{Tg}{dz}"; Ganzhi. Text= msg;
First, the Getsexagenaryyear method is used to return the Ganzhi chronological order (1-60) of the specified Gregorian year, the order value is stored in variable a, and then the zodiac Order (1-10) is obtained from the Ganzhi years using the Getcelestialstem method, because it is an integer value, So you can cast to the Zodiac enumeration we defined above.
Similarly, call the Getterrestrialbranch method to obtain the order of the earthly branches in the Ganzhi (1-12), which can be cast to the value of the earthly enumeration.
Then, we can test it.
First Test with 2017-6-secondly, the result is as follows.
We'll use the 2016-1-test again, and the results are as follows.
A partner will ask, 2016 is not dynasty, yes, but look at the lunar year, it is 2015, 16 New Year's Day, the Lunar New Year is not yet arrived.
We can change the date to 2016-7-1 and then look at the results.
This is the third year of Shen.
We can see what year it is next year.
Next year we can commemorate the 120 anniversary of the "Reform movement".
Well, today's content is here to finish. Please click here to download the sample code.
". NET deep breaths" Get date Ganzhi