Traditional Culture Encyclopedia - Almanac inquiry - How to calculate the lunar calendar and solar calendar

How to calculate the lunar calendar and solar calendar

First of all, I copy and paste, and the algorithm is more complicated. It will be faster if you have strong mental arithmetic ability!

Method for calculating lunar calendar date from solar calendar date;

The date of the lunar calendar is based on the full moon, which takes each new moon as the first day, the full moon as the fifteenth day (the sixteenth day of the big moon) and the dark moon as the twenty-ninth day (the thirtieth day of the big moon). However, at present, time is usually represented by Gregorian dates. If you want to convert Gregorian calendar dates into lunar calendar dates, you can use the following two methods:

One is to check the new calendar. For example, what is the date of June 8 1984 in the lunar calendar? Turning to the perpetual calendar, June 10 is the first day of November in the lunar calendar, so it is inferred that June 8 is the ninth day of September in the lunar calendar.

Secondly, we can use the following formula to calculate the lunar calendar date:

Suppose: the number of AD years-1977 (or1901) = 4q+r.

Then: Lunar date =14q+10.6 (r+1)+the day of the year-29.5n.

(Note: In the formula, Q, R and N are all natural numbers, R.

Example:1The lunar calendar date of May 7, 994 is:

1994- 1977= 17=4×4+ 1

Therefore: q = 4, r = 1.

Then; The seventh day of the fifth lunar month is:

14× 4+10.6 (1+1)+(31+28+31+7)-29.5

= 204.2-29.5 Newton

Then divide 204.2 by 29.5 to get the quotient 6...27.2, where 6 is the value of n and the remainder 27 is the 27th day of the lunar calendar.

First, calculate the formula of annual trunk and branches.

From the palm of your hand, you can count the annual stems and branches, and the flowers in Zhi Zi begin.

Yangzhi began on the 10th and lasted for four years.

Every other position is reversed for ten years, and the end of the year is 503.

Sixty numbers are added and subtracted one by one, and thousands of years are in your hand.

Calculation method: "Palm calculates the annual trunk branches, and Zhi Zi spends its roots." This method is to arrange the ground branches in the palm and calculate the annual trunk branches on the palm. First, locate the ground branch on the palm of your hand (figure 1), and then take the ground branch position as the starting point of the flower, which can be set as 1864, 1924 or 1984? Year 2008 is the year of Jiazi. "Yangzhi is the beginning of ten days, and Tiangan is the tail of four years. "The children, yin, Chen, noon, Shen and Xu in the earthly branches are all Yang branches, and they are also the beginning of every ten days. Heavenly stems are all A's, namely Jia Zi, Jia Xu, Shen Jia, Wu Jia, Chen Jia and Jia Yin. The mantissa of the Gregorian calendar in recent years is 4. "Every other place falls for ten years, and the end of the year is 503." There are ten days to do twelve branches of the earth and heavenly stems and earthly branches combination. Every time the sky is dry, the soil branch is always with the next two branches (Xunkong). The first branch left is the beginning of the later period. We start from the sub-position of the earthly branch, and push back every other bit, that is, from the sub-position to the beginning of JOE 10 anniversary, and then push back from the beginning of JOE 10 anniversary to the beginning of Shenwei-the mantissa is 4 every year, and the annual interval is 10 year. At the beginning of the tenth of the year, the mantissa of the year is 4 as the starting point, starting from the next branch, and the mantissa of the calendar year is 5, 6, 8, 9, 0, 1, 2, 3, and then the beginning of the later period. According to this method, if the year of Jiazi is set to 1984, we can know that 1994 is JOE, 2004 is Shen Jia, and 20 14 is Wu Jia. After determining the number of Gregorian calendar years starting every ten days, we can push forward the trunk and branches of any year as needed. Although it is meaningful, it can push the trunk and branches forward for thousands of years.

Second, the formula for calculating months and hours.

Before the fifth day, the weather is dry, and the order is from the first to the fifth day of the month.

Every year, the number of dry days matches the appearance of the month, and the number of people is the same every day.

Throughout the ages, from the beginning of the year to the end of the year, according to the method of combining heaven and earth, it can be divided into five situations, that is, the method of fixing the month (time) in year A and year B is the same. We also use this method, mainly working the day before, that is, Party A and Party B mainly pay attention to Party A, and G mainly pays attention to Party B.. "The annual stalk is separated from silver moon", and the monthly stalk of a certain year is calculated. First of all, it depends on the combination of annual stem and branch, and then find out the ordinal number of the branch according to the method of "the top five combinations of heavenly stems", set this branch to zero, and determine the heavenly stems of silver moon according to the ordinal number. For example, 1998 is Wuyin, while the Wuxu is dry, and the drying of the Wuxu is the same as that of decyl, which belongs to the same method of fixing silver moon. The ordinal number of five ends with five, starting from five, and after five days of self, Geng, Xin, man and ghost, it can be calculated that the heavenly stems in silver moon 1998 are A, and the heavenly stems in other months are easy to calculate. The calculation method of this sentence is basically the same as the annual drought setting in silver moon, except that after the daily drought combination is determined, the drought combination is calculated from the last drought combination itself and checked according to the serial number, which is the drought combination of the day. Such as auspicious day, auspicious day and Jiazi are the same type, with Jiazi as the main one, and Jiazi's ordinal number is "1". When it is consistent with itself, Tiangan of that day is Jiazi. Similarly, the heavenly stems in the supine position are dominated by five because of their coincidence with the supine position, and the ordinal number is five, counting from five to non-union, and the supine position is non-union.

Second, the size formula of the lunar month divination

Make up two hexagrams a year, and it will be safe in early July and February.

Bian Xiao divination, meet leap moon thirteen Yin ocean.

Leap is between adjacent buildings, and the year and month are determined according to festivals.

Calculation method: In order to know the arrangement order of lunar months and whether there is a leap month in a certain year, this formula is specially formulated. Under normal circumstances, the lunar calendar has twelve months in a year. We can make January to June the first divination, July to December the last divination, two divinations for several years, January the first divination and July the first divination. "Yin and Yang make small hexagrams and meet the 13th of leap month", we will use Yin as the symbol of big month, Yang as the symbol of small month, and Yin and Yang as the symbol of year in order of size. When there is a leap month, there is an extra month, and a year is thirteen months. In leap years, adjacent buildings are located between them, and the year and month should be calculated according to the festival. When there is a leap month in a year, it is represented by yin and yang according to the size of the leap month, and marked on the left side of the middle of the leap month before and after the leap month. Just like divination, you can tell at a glance whether a leap month is a big one or a small one. At the same time, remind everyone that the year and date of the lunar calendar are not determined by the month when the perpetual calendar is compiled, but by the solar terms. For example, in 1998, according to the above method, two hexagrams of well and ridge can be compiled. May this year is a small moon, and the symbol of the first half of the month is ":". : 。 . In the second half of the year, the monthly divination symbol is "= = = =", while in the first half of the year, between the fifth and sixth hexagrams, there is a blessing and a yang. It can be seen that this year's Runmei is 29 days.

Fourth, calculate the daily expenditure formula.

The daily branch can be calculated by the solar calendar and the lunar calendar.

(1) Calculation formula of daily branch of lunar calendar:

The hexagrams of the big moon and the small moon are memorized in the heart, which helps to take root.

After the big trunk, rush in the same place, and the small trunk will retreat for one day.

On the first day of 13 and 25th, the same branch is counted as a branch.

Calculation method: "The big and small moon hexagrams are remembered in the heart, which is fundamental." The big moon in the lunar calendar is 30 days and the small moon is 29 days, which is fixed. In order to calculate the number of branches of the lunar calendar, we must first compile the estimated year with two hexagrams according to the formula of the lunar calendar, so as to calculate thousands of fortunes in a day. In addition, we should also remember the branches and branches on the first day of the first lunar month, because they are the basis for calculating the days of the year. "When the big trunk passes, it will be rushed in place, and when the small trunk passes, it will be retired for one day." The heavenly stems and earthly branches combination in the lunar calendar has 2.5 cycles of heavenly stems. According to this law, the main branch is on the first day of a month. If this month is miscarried, the main branch should be reduced by one in the same branch, that is, the first day of the next month after the miscarriage. For example, on the first day of this month, the main branch is your own, this month is a big month, and on the first day of next month, the main branch is your own. If this month is a miscarriage, the first day of next month should be decided after a person retires, that is, Wushen Day. "On the first day of 13 and 25th, the same branch counts as one." After determining the first day of a month, these two sentences divide a month into three stages, that is, from the first day to the twelfth day, from the thirteenth day to the twenty-fourth day. The first, thirteenth and twenty-fifth days of the first day are also regular in terms of cadres and branches. The first day you know the trunk, as long as you push the trunk every other day, and the branches on the ground remain the same. Similarly, 13 knows the main branch, and 25 knows the main branch. If the first day is Jiazi, thirteen is Bingzi and twenty-five is Wuzi. If you master this method, you can quickly know what day it is according to which festival it belongs to.

(2) Calculation formula of daily trunk and branch in Gregorian calendar:

New Year's Day is the root, and the size of February is in mind.

The little moon works in the same place, and the big moon adds one day.

Shen Chenzi leaps every year, and the same branch rushes back to one day.

On February 28th of the remaining year, the same branch was retired for one day.

On13rd and 25th of the first month of each month, each branch is counted as a branch.

Calculation method: "New Year's Day is the root, and February is the heart." To calculate the daily branches of the Gregorian calendar, we must first remember the branches of New Year's Day. At the same time, we should also know the number of days in January and February. The big month is 3 1 day in the Gregorian calendar, and the small month is 30 days. Its size and month are fixed, but February has 29 days and 28 days. Therefore, we should pay special attention to which year February is 29 days and which year February is 28 days. "Abortion in the same place, big month increased by one day. "The first month of the Gregorian calendar is 30 days. According to the formula of the lunar calendar, we know that the first day of this month is the same as the first day of next month. The big month in the Gregorian calendar is 365,438+0 days. On the basis of the collision between abortion and trunk branches, each trunk branch is added with one digit, which is the trunk branch on the first day of next month after the big one. "Shen Chenzi is a leap every year, and he will retreat with the same branch for one day." It is found that the year when the earthly branches are Shen, Zi and Chen is a leap year in the Gregorian calendar, and February is 29 days. When calculating the main branches in March 1 day, we can calculate according to the daily main branch method after the Lunar New Year, that is, on the basis of doing the same thing in the same place, the main branch is reduced by one, which is the main branch on March 3. "I did the same thing for two days on February 28th this year." Except for the earthly branch, Shenzichen has 29 days in February and 28 days in other years. In February 1 day, when the main subjects were known, in March 1 day, the main subjects were reduced by two places according to the law of the same subject. "On the 13th and 25th of the first month, each branch counts as one." The first day of each month represents the 1 day of each month. Its deduction method is the same as the last two sentences of the lunar calendar.

5. Example: Calculate the trunk and branch of 1998 at the beginning of June of the lunar calendar at noon of 10.

1. First, according to the eight diagrams formula of the Lunar New Year, arrange the Lunar New Year of 1998 with two hexagrams, and mark the leap month. At the same time, remember the first day of the first month and New Year's Day.

4. Calculate the main branch of 1998. According to the formula for calculating the annual trunk branch, we set the position of the trunk branch as Jiazi in our palm, namely 1984, and press our thumb on the position of the trunk branch. According to the principle of "pushing back every other position for ten years", the thumb is pushed forward from 1994, that is, 1994 is JOE, 1995 is yihai, 1996 is Bingzi, and 1997 is Ding.

3. Calculate the main branch of the lunar calendar in June. After determining the main branch of Wuyin in 1998, according to the "fixed-moon main branch tactics", the combination of Wuyin main branch and decyl trunk main branch is E, and the ordinal number of E is 5, so the thumb is fixed at E position. "Work with silver moon every year", starting from the fifth position, the thumb is counted in sequence, that is, the first month of 1998, that is, the first month's work is Jiayin, and then the first month's work is, according to A, Ji, C, D and E, it is the last month's work.

4.6 months 10 day (August 1 day in Gregorian calendar) to calculate the trunk and branch.

(1) Calculate the daily branch of the lunar calendar. As mentioned earlier, in 1998, the hexagrams of the big moon and the small moon were wells and ridges. Because the leap month in May is 29 days, it is a yang, which is located in the fifth and sixth questions of "well", and the shape of the hexagram is = 丨丨 =.

Because we want to calculate that the trunk and branch of 1998 on the first day of the first lunar month are from the sea, we should first locate the trunk and branch on the palm of our hand with our thumb, and then calculate the trunk and branch of 1 day month by month according to the stipulation that "the big trunk and branch are in the same place, and the small trunk and branch are retired one day" in the calculation of the daily trunk and branch of the lunar calendar. The first month is big, the trunk is the same as the branches, and the thumb jumps to the fourth position. At the beginning of February, the trunk was the second one on 1; The trunk and branches decreased by 1 respectively, and the thumb decreased by 1 after jumping to the sea. At the beginning of March, the trunk and branches were both JOE1; March is smaller, and the trunk and branches decrease by 1 respectively. Thumb jumps behind Chen Ke 1, and it was 1 in early April. April is big, the stem is the same branch, the thumb jumps to the unitary stem, and it is 1 in early May. May is a small moon, the trunk and branches decrease by 1 respectively, the thumb jumps to the branches and then retreats by 1, and the leap in early May is 1. The leap in May is small, and the trips of the same branch are reduced by 1 respectively. After the thumb jumps to apply for a branch, it will retreat one place. At the beginning of June, the first branch was established in Weixin. Knowing the main branch of 1 in early June, the main branch of 10 in early June is Chen Geng.

(2) Calculate August 1 of Gregorian calendar.

The main branch of 1998 is Wuyin, and the annual branch does not belong to Shen Chenzi, so February of 1998 is 28 days. According to the calculation formula of the Gregorian calendar, it is calculated month by month according to the law of "the small moon branches are offset in the same place, one day before the big moon, and the branches are offset for two days on February 28th of the remaining year". 1998, he applied for the post of Wu Shen, and his thumb was fixed on the applied post. June 1 is the big month, one day is added for the same branch, the thumb jumps from the application position to the negative position, 1 is added to the socket, February 1 is the socket, February 28th is the two days for the same branch, and the thumb jumps to the unitary position for two branches, and March 1 is the Ding Wei; 3 big, 1 day rushed to the same branch, the thumb jumped ugly. April 1 day, the main branch is Wuyin; In April, this is a small, dry and dry rush, and the thumb jumps to the application position. In May, 1, the main branch is Wu Shen; May is a big day, the trunk is added with the same branch 1 day, and the thumb jumps to the unitary position. July 1, the trunk is unitary; In July, it was a big day. Trunks and branches rushed 1 day, and the thumb jumped to 1 position and arrived in Chen Chen. In August, trunks and branches are in Chen Geng.

5. It is estimated that the first day of June in the lunar calendar is 10 (August in the solar calendar, 1), and the main branch of this day is Chen Geng. According to the "punctuality tactics of cadres and branches", we can see that the cadres and branches of that day are consistent with themselves, and according to the "five combinations of heavenly stems", our ordinal number is 2, and our thumb is set in the position of heavenly stems. "Days when the sky is dry and things are dry", the thumb goes from the second row to the third row, and we can know that a day in Chen Geng is the third row. When you push your thumb from Bingzi to noon, the sky is dry and noon is dry.

By calculating the year, month, day and hour on the palm of your hand, we can know that the noon of 1 early June of the 998 lunar calendar 10 (1in August of the Gregorian calendar) is at noon on Chen Geng Day, which is the last month of Wuyin.

Six, several issues that need attention.

On the basis of understanding Feng's method of skillfully calculating the year, month, day and time on the palm of his hand, this paper combines the clever recording of the formula with the positioning calculation on the palm of his hand, and often compares it with the perpetual calendar to achieve the purpose of skilled use.

When using this method again, we should first make a table and take it with us to calculate the annual expenditure.

The table is as follows:

Year serial number This year's big and small month divination (leap) is on the first day of the first month in beginning of spring, and the main branch is on New Year's Day.

1988: 丨丨:: 丨 font On the eighth day of the first month, Gengzi arrived in Shanghai.

1999 丨丨: 丨: On December 19th of the lunar calendar, at the end of Dinghai Day, Jiazi was humiliated.

When calculating the daily main branch, we must pay attention to the size of the month and distinguish the main branch from the main branch.

Methods of skillfully pushing the year, month, day and time of the palm (appendix)

First, the formula for calculating New Year's Day cadres and cadres year by year.

If you want to push New Year's Day next year, the prophet will do something this year.

Shen's earthly branch year is a leap year, with six earthly branches added.

I will add five people to my work for the rest of this year, and I will know when I retire.

Calculation method: "If you want to push New Year's Day next year, the prophet will do something this year." To calculate the trunk and branch of New Year's Day next year, we must first know the trunk and branch of New Year's Day this year, and locate it on the palm of your hand with your thumb. "Shen's dry year is a leap and has added six branches. "Every year when Shen comes, it is a leap year, February 29th. To calculate the trunk and branch of New Year's Day next year, as long as the thumb jumps from the trunk and branch of this year's New Year's Day to the competitive trunk and branch, then the trunk and branch of next year's New Year's Day will be added with six. "I will add five people for the rest of this year, and I will know when I retire." Except Shen Nian, February in other years is 28 days. The thumb is fixed on the palm of your hand to determine the position of the earthly branch on New Year's Day this year. When calculating the new year's day branch next year, jump your thumb to the conflict branch and retreat one place, and add five days to the main branch, which is the main branch next year.

Second, calculate the formula of the first day of the first month year by year.

If you want to push the coming year to 1 month, the prophet will make a difference this year.

Returns the number of small months in the whole year, and the decimal number of leap months is 567.

Small six cadres every three days, the first sentence of five plus one.

Every seven branches are separated by three days, and each branch is the same.

Calculation method: "If you want to push the coming year to 1 month, the prophet will do something this year." To calculate the dry branch on the first day of the first month of next year, we must first know the dry branch on the first day of the first month of this year. "Returns the number of small months in the whole year, and the decimal number of leap months is 567." Perennial refers to the year without leap months. To calculate the first day of the first lunar month, two hexagrams should be compiled year by year according to the lunar formula to determine the number of small months in a certain year. If there is no leap month this year, please be on the first day of the first month of next year. After research, there are five, six and seven small months in each leap month year. "Small six cadres are separated by three days, and one sentence is added to each of the first five sentences." In a leap month year, if the number of small months is six, the branches on the first day of the first month of next year will be the same, and the branches on the first day of last year will be the same, and the branches will be separated by three places. If the number of abortions is five, the first day of the first month of the next year is the first day of the first month. "Every seven branches are every three days, and it is the same to return one." If the number of months in a leap month is 7, the first day of the first month of the current year will be calculated after the first day of the first month of the next year is determined. As long as the branches are separated by three places, the branches will be reduced by one, and the branches will be on the first day of the first month of the next year.

Third, the method of calculating the first day of each month in Gregorian calendar with divinatory symbols.

Calculating the branches and earthly branches on the first day of each month in the Gregorian calendar with divinatory images is mainly based on the fact that the size of the Gregorian calendar and the month are inconvenient to fix, and a divinatory image suitable for any year is compiled. Then, according to the cycle law of large and small branches, the branch on the first day of each month is calculated. In the Gregorian calendar, the months of the year have fixed divination images. In the first half of the year, it was "Wei Ji" divination, and in the second half, it was a divination image, as shown in Figure 3. In the process of calculation, we should pay special attention to February, because there are 28 days and 29 days, so the words leap year and non-leap year are marked in wiki divination to attract attention in calculation. When calculating, we should determine the trunk and branch on the first day of next month based on the formula for calculating trunk and branch in Gregorian calendar, and then calculate the trunk and branch on the required date according to the principle of "first month 13: 25, one branch is separated from the other". Figure 3.

June 1st+1 65438+ February = 1+ 1.

May = one day dry and one day offset 1 1 month dry and one day offset+1.

April 1st+1 10 = 1+00.

March = leap day, dry in place+1 September, dry in place+1.

On February 29th of leap year, it is not the same day-August = the same day+1.

On February 28th of a non-leap year, one day's work is the same as another day+1.

65438+ 10 month = New Year's Day, main branch, July = one day, same branch.

Fourth, the method of calculating the first day of the lunar month with divinatory symbols.

The number of months in the lunar calendar is fixed, that is, the big month is 30 days and the small month is 29 days. However, due to the irregular arrangement of large and small months, it is necessary to compile the monthly divination in the first half of this year according to the formula of the lunar calendar. Then, according to the two figures, referring to the calculation formula of daily branches and branches in the lunar calendar, after knowing the daily branches and branches on the first day of the first month, according to the law of "the big branches and branches are in the same place, and the small branches and branches are each retired by one day", the daily branches and branches on the first day of each lunar month are calculated by numbers. Through research, it is found that there are four ways to arrange the large and small months of the lunar calendar, and the calculation method of the first day of each month is as follows:

(1) Two miscarriages are adjacent to each other. (2) Two big miscarriages.

-Do the same thing next month.-1 = Do it next month.

-The first day of this month = the first day of this month.

(3) adjacent to each other (4) adjacent to each other.

-Same offset next month = Same offset next month-1

= the first day of this month-the first day of this month

△ Example: Calculate the first branch of each month in 200 1

1. According to the formula of the lunar calendar, 200 1 this year will be compiled as the last month's divination. In the first half of the year, it was the "Gen" divination, and in the second half, it was the "Ji" divination.

4.200 1 the first day of the first month, with Ding Hai as the main branch.

3. When calculating, we should compare two adjacent months of 1, February, March and April, and then calculate according to the same type.

4. According to the divinatory symbols, it is calculated month by month.

In June, "——" Gantongzhi rushed to Ji You 65438+February "=" Gantongzhi rushed to the new temple 0.

In May, "-"Tongkechong-1 Bazaar11"-"Tongkechong Renzi.

Leap April "-"Trunks and branches rush to Xu Bing 65438+ October "=" Trunks and branches-1 noon.

April-"Dry with the same branch-1 Chen Bing" September-"Dry with the same branch to rush the sunflower ugly.

March "-"The main branch will rush to the sea in August "=" The main branch will rush at the end of the year-1.

February "-"Dry the same branch to urge Ding Si to July "-"Dry the same branch to urge-1 Jiayin "

65438+ October "-"the first day of the first month in Dinghai ".

After divination, it is estimated that 65438+ the first day of the second lunar month is Xin Si.