Fortune Telling Collection - Comprehensive fortune-telling - Lunar conversion

Lunar conversion

How to convert the national calendar into the lunar calendar? The first day of each month is called new moon, and the last day is called darkness. The fifteenth, sixteenth or seventeenth day of the lunar calendar is called Wangwang, and the day after Wangwang is called Wangwang, so New Year's Eve of the lunar calendar is not the same day every year. The basis of the lunar calendar is the year of the tropic of Capricorn and the first month. The tropic year is the time required for the sun to pass through vernal equinox twice in a row, that is, 365.2422 days (365 days, 5 hours, 48 minutes and 46 seconds). "The first month of the lunar calendar" is the time between two consecutive new moons (new moons) or two full moons (full moons), that is, 29.5306 days (June 29th 12 hours, 44 minutes and 3 seconds).

Because 12 "Wang Shuoyue" is only 354.3672 days, which is more than 10 days different from 365.2422 days in the tropic year, this difference adds up to a leap month. As early as the Spring and Autumn Period in 5600 BC, China calendar adopted the arrangement of seven leap months in 19 years.

However, the calculation method of China lunar calendar is different from that of * * * and Korean lunar calendar, which is generally one or two days apart.

The date of the lunar calendar is based on the full moon, and each new moon is the first day. The full moon is 15th (16th) and 29th (30th). However, at present, the date of the solar calendar is usually used to express the time. If you want to convert the date of the solar calendar into the date of the lunar calendar, you can use the following two methods: one is to search the newly edited perpetual calendar, for example, what is the date of the lunar calendar on June 8, 1984? Open the perpetual calendar, 10 June is the eleventh lunar month, so it is inferred that June 8 is the ninth day of the ninth lunar month. Secondly, we can use the 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)+date ordinal of the year-29.5n.

(Note: In the formula, q, r and n are all natural numbers, and the comparison table for converting R lunar calendar into Gregorian calendar is Gregorian calendar1April 29th, 945.

The conversion between the national calendar and the lunar calendar, the first day of each month is called new moon, and the last day is called dark. The fifteenth, sixteenth or seventeenth day of the lunar calendar is called Wangwang, and the day after Wangwang is called Wangwang, so New Year's Eve of the lunar calendar is not the same day every year. The basis of the lunar calendar is the year of the tropic of Capricorn and the first month. The tropic year is the time required for the sun to pass through vernal equinox twice in a row, that is, 365.2422 days (365 days, 5 hours, 48 minutes and 46 seconds). "The first month of the lunar calendar" is the time between two consecutive new moons (new moons) or two full moons (full moons), that is, 29.5306 days (June 29th 12 hours, 44 minutes and 3 seconds). Because 12 "Wang Shuoyue" is only 354.3672 days, which is more than 10 days different from 365.2422 days in the tropic year, this difference adds up to a leap month. As early as the Spring and Autumn Period in 5600 BC, the calendar of China adopted the arrangement of seven leap months in nineteen years. However, the calculation method of China lunar calendar is different from that of * * * and South Korea, with a general difference of one or two days. The date of the lunar calendar is based on the full moon, and each new moon is the first day. The full moon is 15th (16th) and 29th (30th). However, at present, the date of the solar calendar is usually used to express the time. If you want to convert the date of the solar calendar into the date of the lunar calendar, you can use the following two methods: one is to search the newly edited perpetual calendar, for example, what is the date of the lunar calendar on June 8, 1984? Open the perpetual calendar, 10 June is the eleventh lunar month, so it is inferred that June 8 is the ninth day of the ninth lunar month. Secondly, we can use the formula to calculate the lunar calendar date: suppose: AD year-1977 (or 190 1) = 4q+r, then: lunar calendar date =14q+10.6 (r+ A year is divided into 12 months, big month 3 1 day, small month 30 days, and February only has 28 days. The mantissa of four years accumulates to *** 1 day, and is added to February of the fourth year, which is called leap year. So February in leap year has 2 9 days. The lunar calendar orders a full moon for one month, ***29 and a half days. For the convenience of calculation, the big month is 30 days and the small month is 29 days. In 12 months of a year, large and small months are generally arranged alternately. The lunar calendar has only about 354 days a year, and there is no difference between a normal year and a leap year. The lunar calendar does not consider the movement of the earth around the sun, so the changes of the four seasons in the lunar calendar have no fixed time and cannot reflect the seasons, which is a great shortcoming. In order to overcome this shortcoming, people later decided on a calendar called Yin-Yang calendar. The summer calendar still in use in China (some people call it lunar calendar or lunar calendar) is this kind of lunar calendar. Like the lunar calendar, it is also based on the bright and full time of the moon to customize a month, with a big month of 3 0 days and a small month of 29 days. However, it also adopts the method of adding leap months to make the average number of days in a year close to the number of days in the solar calendar to adjust the four seasons. Every two or three years, there will be an extra leap month in the summer calendar. The lunar calendar, also known as the lunar calendar, takes the moon's orbit around the earth as one month and the earth's orbit around the sun as one year, which is actually equal to the lunar calendar. This calendar was adopted in China before the first year of the Republic of China, so it is called the old calendar. Generally speaking, the lunar calendar is suitable for farmers and is named "Lunar Calendar".

How are the lunar calendar and Gregorian calendar converted? (how to calculate? ) Do you calculate by mouth or by pen?

I'm telling you, this is unreliable, it can't be calculated at all, and the transformation involved is not a simple formula. On the contrary, its transformation is quite complicated.

If you are interested in writing programs, I can provide a library of conversion functions. You can realize the conversion between the lunar calendar and the Gregorian calendar by calling a function.

At present, I have realized the transformation perfectly, and I can provide it if necessary.

What is the formula for converting the lunar calendar into the Gregorian calendar? Because the Gregorian calendar (the Gregorian calendar is used now, and the Confucian calendar was used before) and the China lunar calendar are not calculated strictly according to a formula, there is no direct formula for the two calendars.

It is impossible to use a simple formula instead of using a lot of data like a perpetual calendar (although it can be simplified) to achieve the purpose of conversion between public and lunar calendar. All the software that we can see to convert Gregorian calendar into lunar calendar contains calendar data of different years.

Among these data, the most important is the number of days in each month of the lunar calendar. Because the lunar calendar is a lunar calendar, the part of the lunar calendar (according to the phase of the moon) determines a certain day in a month, and the part of the solar calendar (according to the height of the sun) is a solar term. Solar terms basically correspond directly to the Gregorian calendar, which is easy to calculate; However, the relationship between the moon phase period and the earth's revolution is relatively complicated, and generally requires astronomical observation data to give the time, so there is no simple formula for whether a lunar month is a big moon or a small moon.

As for the leap between the Gregorian calendar and the lunar calendar, there is a certain calculation method, which is not difficult.

If it is only astronomical data, it can still be counted-because the astronomical period is very stable, we only need to calculate it strictly according to the astronomical period. But there is another troublesome point, that is, the solar calendar and the lunar calendar are not strictly in accordance with the actual astronomical cycle, and there are many human factors. The most famous is that the Roman emperor revised the length of February and August for many times. Due to inaccurate calculation, the 10th was artificially deleted from julian calendar. In China, the calendar published by * * * is inconsistent with the astronomical phenomena because the ancient astronomical observations are inaccurate (we can't demand the accuracy of ancient observations). Therefore, these two calendars are related to a period of society, so there is no certain law to follow.

How to convert China's solar calendar, lunar calendar and solar calendar in dates? Baidu is too complicated to study by itself.

How to Convert Gregorian Years into Lunar heavenly stems and earthly branches In ancient China, heavenly stems and earthly branches was used to record years, but it was rarely used in modern society. First, today's society is inseparable from internationalization, and it is unrealistic to follow the old rules; Secondly, heavenly stems and earthly branches is mostly used for folk fortune-telling and word-testing, with a strong superstitious color, which is really incompatible with modern science and technology society. But an excellent nation will not abandon its own history and culture. In historical events, poetry, calligraphy and painting, there are a lot of chronicles of heavenly stems and earthly branches, so it is necessary to know and be familiar with him. Let's take a look at it a little: 1. The origin of heavenly stems and earthly branches is called "trunk" for short in heavenly stems and earthly branches, and heavenly stems and earthly branches is equivalent to trunk and leaves. They are an interdependent and coordinated whole. In ancient China, heaven was the "master" and the earth was the "slave". The interconnection between "heaven" and "dryness" is called "heavenly dryness"; The relationship between "earth" and "branch" is called "earth branch", which together is "heavenly stems and earthly branches". There are ten words for heavenly stems, which are always called "ten heavenly stems". There are twelve characters in the earthly branches, which are collectively called "Twelve Earthly Branches". In the original meaning of heavenly stems and earthly branches, there is an interesting saying: 1, heavenly stems (A) sprout like grass forest, and the sun is covered with shade. Others think that the armor of armor also highlights everything by breaking through its armor. (b) The vegetation is primary, with soft, elastic and slender branches and leaves. The second one is rolling. (C) C, C, like the bright sun, scorching fire, everything belongs to Ming Che. (d) vigorous, vegetation grows vigorously, just like a person's maturity. (e) Mao Ye symbolizes the lush vegetation on the earth. From (since), discipline is also, everything turns back, tangible and disciplined. (g) More importantly, the autumn harvest should wait until spring. (Xin) Jin Weixin, when things are done, they will taste. Others believe that the new is also new, and they are in awe of all changes and show new achievements. Pregnancy, when everything is pregnant, the sun is an elf lurking underground. (1) Yes, everything is hidden, gestated, underground and budding. 2, the ground branches (seeds) are also awkward, flowers and trees have children, and the water in the soil is sucked out, which is the beginning of a yang Meng. (Ugly) Cattle fields, where vegetation germinates, bends and leaves the ground. Swallow leaves, gold leaves, flowers and trees that bend in cold soil protrude from the ground to meet the spring day. (Ye Mao, Rizhao East, everything is thriving. (Chen) The earthquake also extended that everything was born from the earthquake, and the sun was over half. (3) Everything begins to grow, yin disappears, and pure yang has no yin. (noon) Hey, everything is full and full, the yang is full, and the yin is budding. Delicious (not delicious), ripe fruit is delicious. (Shen) Both the body and the object have grown up. You are still alive when you are old, and everything is still shrinking and converging. Extinction, vegetation withers, anger goes out. (sea) illegal, illegal killing, has reached the extreme. Heavenly stems and earthly branches is said to have been invented in ancient times four or five thousand years ago. For example, Liu Shu in the Tang Dynasty quoted an ancient book and said, "(The Yellow Emperor) made great efforts to govern …………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………… At first, our ancestors only used the sky to record the days, because the days of a month were carried by the days; Remember the months with earthly branches, because ten months in a year exactly match ten earthly branches. However, not long after, people think that there will still be three days in a month when only the sky is dry to record the days. Therefore, a heavenly stem and a earthly branch are used to record dates in turn, such as Shangshu. Gu Ming says, "Only April is full of life. Kings don't make choices. Jia Zi, Wang Nai Tao Zanshui, was crowned with clothes. According to the records, this means that in early April, Wang felt very uncomfortable. On Jiazi Day, Wang Cai washed her hair and face. The servant dressed the king, and Wang Yi sat on the jade table. Later, the method of recording the day was gradually introduced to record the year, month and time. Sixty flowers Jia Zi China lunar calendar uses heavenly stems and earthly branches as the method to calculate the year, month, day and time, that is, each heavenly stems and earthly branches is paired in a certain order, without repetition, as the code of the year, month, day and time. Put a word in the front "heavenly stems" and a word in the back "earthly branches", thus forming a pair of stems and branches. If "Tiangan" starts with "A" and "Dizhi" starts with "Zi", we can get: 1. Jiazi 2. Picnic 3. Bing Yin 4. Ding Mao 5. Chen Wu 6. Jiu Si 7. Wu Geng 8. Xinwei 9. Ren Shen 10. & gt

I don't know much about the programming of lunar conversion algorithm.

Pass on the formula.

Multiply by five and divide by four and nine days.

The interval between two months is thirty days.

One, two, plus one, minus one,

The top ten tails of 3578.

The specific algorithm can be found online. There is a lot of information on Baidu, so I won't go into details.

Conversion from Gregorian calendar to Gregorian calendar, Gregorian calendar and lunar calendar

(128× 365+3 1) day ÷ 128 = 365.438+0875 day/year.

It can be seen that the leap accuracy of * * * is much higher than that of modern Gregorian calendar.

2. Correction of one-day error in conversion

Calendar series takes 1387 January as an example, and calculates the year, month and day according to the Gregorian calendar.

Solution1:1387× 0.970224+621.5774 =1967.088.

0.278088× 365.2422 days = 10 1.569 days. The cumulative number of days in the Gregorian calendar is 10 1.57 days, which can be regarded as April 1 1 or April 12. What day is today? When two calendars have the same week ordinal number in April 1 1 or 12 of Gregorian calendar, it will be revised.

According to the calculation formula of ordinal number in the first week of Muharram:

[(138-1) ×131+164] ÷ 30 = 6057, with the remaining 20.

6057 ÷ 7 = 865, leaving 2.

So 1387' s New Year's Day is Tuesday. (Form)

According to the Gregorian calendar from1New Year's Day (Saturday, 583) to1April, 9671day, * * * calendar:

1967- 1583 = 384. In these 384 years, the Gregorian calendar has a leap of four years, but there is no leap of one hundred years. The rule of adding a leap day in 400 years * * * has 93 leap days, from1the day after New Year's Day in 967 to April 165438.

(384× 365+93+100+6) ÷ 7 =140359+7 = 2001,and the remaining 2 is Tuesday, so the New Year's Day of Ramadan 1387 falls on the Gregorian calendar/kloc-.

Because the Gregorian calendar uses a lot of data to calculate the number of Sundays, there are inevitably some omissions in the calculation. Now we introduce the calendar date and week calculation table for your reference.

Use this table to find the day of April 1967+ 1 1. The steps are as follows:

First, find the position of the word 19 in the first two digits of this year table;

Then find the position of the word 67 in the last two digits of the year table, and move to the right in parallel from the word 19, and the word 67 moves vertically downward, and the two words intersect at the letter G in the English capital column;

Then check April from the column of the monthly table, move from the position of April to the left in parallel, and check the position of G in the column of April;

Find the position of 1 1 from the date column, and move from this position to the right in parallel, so that the intersection of April and G column is called Tuesday, and the result is the same as that calculated in Hijri. So we know that New Year's Day 1387 is indeed 1967 April1,not 12.

In conversion, Gregorian calendar days often exceed 365,438+0 days, or even 200-300 days. When this number needs to be converted into the month and day of the year, you can use the following two tables.

Table 3 Gregorian calendar months and their cumulative days

Convert Gregorian calendar into hijri calendar

The formula of converting Gregorian calendar into Gregorian calendar can be obtained by shifting and sorting.

(Gregorian calendar 1 year 621.5691) ÷ 0.9702 = Muhalam (julian calendar) .............................. (5)

(Gregorian calendar 1 year 62 1.5774) ÷ 0.970224 = Muharram (Gregorian calendar) ......................... (6)

Whether hijri is converted to Gregorian calendar or not, there is usually a difference of one day. When the number of weeks is modified, the hijri calendar is converted into Gregorian calendar, and the number of weeks in hijri calendar shall prevail; On the contrary, the number of weeks in the Gregorian calendar shall prevail.

Four national calendars or Gregorian calendars were converted into the China lunar calendar.

1. Conversion from hijri to lunar calendar

Although the number of months in China lunar calendar is not a relatively stable value, which brings more difficulties to the conversion of solar calendar and Gregorian calendar into lunar calendar, it can still be converted. China's lunar calendar is a combination of yin and yang, which belongs to the lunar calendar in terms of month and hijri, but hijri starts from the new moon every month, and its date is about 1-2 or even 3 days after the new moon (the first day of the lunar calendar), so as long as we find out the relationship between them, we can convert hijri into China lunar calendar. Mr. Ma said to him, "> >;