C # calculation formula of Julian day

Source: Internet
Author: User
Tags julian day

Astronomy has a type of consecutive days of Confucianism (JD), which begins with the GMT noon of January 1, 4713 BC on 0th. There is also a simplified Confucianism Day (MJD): MJD = JD-2400000.5 MJD's 0th day started from GMT on November 17, 1858 AD.

Note: The Gregorian calendar January 1, 4713 BC is equivalent to the Gregorian calendar November 24, 4713 BC. Julian day refers to the number of days that have elapsed since noon in the Coordinated Universal Time on January 1, January 1, 4713 BC. It is mostly used by astronomy as a single calendar of astronomy, unify the year tables of different calendars. RuO Day is a long-term date-based method that does not use years and months. It is abbreviated as JD. It was created in 1540 by French scholar Joseph Justus Scliger (1609-1583) to commemorate his father, Italian scholar Julius Caesar Scaliger (1484-1558 ).

The starting point of ruru day is 4713 BC (astronomy is recorded as-4712) January 1, January 1 GMT (Universal Time). That is, JD 0 is specified as 4713 B .C. january 1 UT to 4713 B .C. 24 hours for January 2 UT. Each day, a unique number is given, which goes down by number. For example, at 12:00:00, January 1, January 1, 1996, the day of Confucianism is 2450084. This date is based on the operation cycle of the sun and the moon, and the tax collection interval at that time. Joseph Scliger defines the ruru cycle as 7980, because the minimum public multiples of 28, 19, and 15 are 28 × 19 × 15 = 7980. Among them: 28 years is a solar cycle (solar cycle), after a solar cycle, the day of the week and the day of the month will be repeated. 19 years is a lunar cycle, or Metonic cycle, because the 19th lunar month = 19 years of return to the year, after a lunar cycle, the day sequence of the lunar year is repeated. 15 years is an indiction cycle, issued by the Roman emperor Constantine. Every 15 years, the property value is assessed for tax and becomes an epoch unit used in ancient Rome, therefore, the period from January 1st to January 1st is the same as that from January 1st. The date of calculation is the number of days between two events that are separated by a long time or different calendars. Due to the fact that there are too many characters in the number of vertices, The International Astronomical Federation adopted MJD in 1973, which was defined as MJD = JD-2400000.5. MJD starts at UTC, January 1, November 17, 1858.

The calculation of the Confucian day = K-32075 + 1461 * (I + 4800 + (J-14)/12)/4 + 367 * (J-2-(J-14) /12*12)/12-3 * (I + 4900 + (J-14)/12)/100)/4

The calculation formula is as follows.

For example: 2009/1/1 The conversion to Julian day should be 2454833 (total 7 yards )

Code
/// <Summary>
/// Julian day of the production date
/// </Summary>
/// <Param name = "year"> year </param>
/// <Param name = "month"> month </param>
/// <Param name = "day"> day </param>
/// <Returns> Julian day </returns>
Private long julian (int year, int month, int day)
{
Long jy = year, jm = month, jd = day;
If (jy <0)
{
Jy = jy + 1;
}
If (month> 2)
{
Jm = jm + 1;
}
Else
{
Jm = jm + 13;
Jy = jy-1;
}
Long jul = Convert. ToInt64 (Math. Floor (365.25 * jy) + Math. Floor (30.6001 * jm) + jd + 1720995.0 );
If (jy <1582 & jm <10 & jd <15)
{
Return jul;
}
Else
{
Long ja = Convert. toint64( 0.01 * jy );
Jul = Convert. ToInt64 (jul + 2-ja + 0.25 * ja );
Return jul;
}
Related Article

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.