using System; namespace CNCalendar {public class CNDate {private const ushort START_YEAR = 1901; private const ushort END_YEAR = 2050; private string [] ConstellationName = { "Aries", "Taurus", "Gemini", "Cancer", "Leo" , "Virgo", "Libra", "Scorpio", "Sagittarius", "Capricorn", "Aquarius", "Pisces"}; private string [] lunarholdayname = {"small cold", "big cold", "小" "" Rainwater "," horror "," spring festival "," Qingming "," Gu Yu "," Lixia "," Xiaoming "," Mang "," Summer "," Xiaoxia "," Summer "," Autumn ", "Summer", "Bai Lu", "Autumn", "Hanu", "Frost", "Land Winter", "Snow", "Snow", "Winter Solo"}; // A group of glunarday deposits into the lunar calendar 1901 to 2100 annually The number of monthly months in the middle, // 阴 阴 历 can only be 29 or 30 days, with 12 (or 13) binary positions, corresponding to 1 table 30 days, otherwise 29 days private int [] glunarmonthday =
{// Test data is only 1901.1.1 --2050.12.31 0x4ae0, 0xa570, 0x5268, 0xA8, 0x56a0, 0x9ad0, 0x4ae8, 0x4ae0, // 1910 0xa4d8, 0xa4d0, 0xD250, 0xD548, 0xB550, 0x56a0, 0x96d0 , 0x95b0, 0x49b8, 0x49b0, // 1920 0xa4b0, 0xb258, 0x6a50, 0x6d40, 0xada8, 0x2b60, 0x9570, 0x4978, 0x4970, 0x64b0, // 1930 0xd4a0, 0xea50, 0x6d48, 0x5ad0, 0x2b60, 0x9370, 0x92e0, 0xc968, 0xc950 , 0xd4a0, // 1940 0xda50, 0xb550, 0x56a0, 0xaad8, 0x25d0, 0x92d0, 0xc958, 0xa950, 0xb4a8, 0x6ca0, // 1950 0xb550, 0x55a8, 0x4da0, 0xa5b0, 0x52b8, 0x52b0, 0xa950, 0xe950, 0x6aa0, 0xad50, / / 1960 0xab50, 0x4b60, 0xa570, 0xa570, 0x5260, 0xe930, 0xd950, 0x5aa8, 0x56a0, 0x96d0, // 1970 0x4ae8, 0x4ad0, 0xa4d0, 0xd268, 0xd250, 0xd528, 0xb540, 0xb6a0, 0x96d0, 0x95b0, // 1980 0x49b0, 0xa4b8, 0xa4b0, 0xb258, 0x6a50, 0x6d40, 0xada0, 0xab60, 0x9370, 0x4978, // 1990 0x4970, 0x64b0, 0x6a50, 0xea50, 0x6b28, 0x5ac0, 0xab60, 0x9368, 0x92e0, 0xc960, // 2000 0xd4a8, 0xd4a0, 0xda50, 0x5aa8, 0x56a0, 0xAad8, 0x25d0, 0x92d0, 0xc958, 0x a950, // 2010 0xb4a0, 0xb550, 0xb550, 0x55a8, 0x4ba0, 0xa5b0, 0x52b8, 0x52b0, 0xa930, 0x74a8, // 2020 0x6aa0, 0xad50, 0x4da8, 0x4b60, 0x9570, 0xa4e0, 0xd260, 0xe930, 0xd530, 0x5aa0, // 2030 0x6b50, 0x96d0, 0x4ae8, 0x4ad0, 0xa4d0, 0xd258, 0xd250, 0xd520, 0xdaa0, 0xb5a0, // 2040 0x56d0, 0x4ad8, 0x49b0, 0xa4b8, 0xa4b0, 0xaa50, 0xb528, 0x6d20, 0xada0, 0x55b0}; // 2050 // Array Glanarmonth stores the month of the lunar calendar from 1901 to 2050, if it is 0, each word is two years byte [] glunarmonth =
{0x00, 0x50, 0x04, 0x00, 0x20, // 1910 0x60, 0x05, 0x00, 0x20, 0x70, // 1920 0x05, 0x00, 0x40 0x02, 0x06, // 1930 0x00, 0x50, 0x03, 0x07, 0x00, // 1940 0x60, 0x04, 0x00, 0x20, 0x70, // 1950 0x05, 0x00, 0x30 0x80, 0x06, // 1960 0x00, 0x40, 0x03, 0x07, 0x00, // 1970 0x50, 0x04, 0x08, 0x00, 0x60, // 1980 0x04, 0x0a, 0x00, 0x60, 0x05, // 1990 0x00, 0x30, 0x80 0x05, 0x00, // 2000 0x40, 0x02, 0x07, 0x00, 0x50, // 2010 0x04, 0x09, 0x00, 0x60, 0x04, // 2020 0x00, 0x20, 0x60, 0x05, 0x00, // 2030 0x30, 0x50, // 2040 0x02, 0x07, 0x00, 0x50, 0x03}; // 2050 // array Glanarholiday stores each year's twenty-four-air calendar dates / / The twenty-four hollow calendar of the twenty-four hollow calendar is almost fixed, and the average distribution in 12 months / / January 200. April April May / / Small cold, cold spring, rain, spring, spring, clear, Yuti, Xia Xia, September, September, September, September, September, September, September, September, September, September, September, September, September, September, September, September, September, September, September *********************************************************** ************************ // No reason to determine the law, so there is time to save the table, save space, so ... // ** *********************************************************** *****************************} // Data format Description: //, such as 1901 Shanning to / / January 2 March April 2009 July August Sep 5, September, September 1, September // 6, 21, 4, 19, 6, 21, 5, 21, 6, 22, 6, 22, 8, 23, 8, 24, 8, 24, 8, 24, 8, 23, 8, 22 // 9, 6, 11, 4, 9 6, 10, 6, 9, 7, 9, 7, 7, 8, 7, 9, 7, 9, 7, 9, 7, 8, 7, 15 //, the first line of data above is the monthly ride corresponding Date, 15 minus the first holiday month, the second holiday minus 15 get the second row // This monthly two flying corresponding data is less than 16, and use one byte by one byte every month, high storage A throttle data, low storage // second throttle data, you can get the following table Byte [] Glunarholday =
{0x96, 0x97, 0x97, 0x78, 0x79, 0x79, 0x69, 0x78, 0x77, // 1901 0x96, 0xA4, 0x96, 0x96, 0x97, 0x87, 0x79, 0x79, 0x79, 0x69, 0x78, 0x78, // 1902 0x96, 0xa5, 0x87, 0x96, 0x87, 0x87, 0x79, 0x69, 0x69, 0x69, 0x78, 0x78, // 1903 0x86, 0xa5, 0x96, 0xa5, 0x96, 0x97, 0x88, 0x78, 0x78, 0x79, 0x78, 0x87, // 1904 0x96, 0x97, 0x97, 0x78, 0x79, 0x79, 0x69, 0x78, 0x77, // 1905 0x96, 0xa4, 0x96, 0x96, 0x97, 0x97, 0x79, 0x79, 0x79, 0x69, 0x78, 0x78, // 1906 0x96, 0xa5, 0x87, 0x96, 0x87, 0x87, 0x79, 0x69, 0x69, 0x69, 0x78, 0x78, // 1907 0x86, 0xa5, 0x96, 0xa5, 0x96, 0x97, 0x88, 0x78, 0x78, 0x69, 0x78, 0x87, // 1908 0x96, 0x97, 0x96, 0x78, 0x79, 0x79, 0x69, 0x78, 0x77, // 1909 0x96, 0xA4, 0x96, 0x96, 0x97, 0x97, 0x79, 0x79, 0x79, 0x69, 0x78, 0x78, // 1910 0x96, 0xa5, 0x87, 0x96, 0x87, 0x87, 0x79, 0x69, 0x69, 0x69, 0x78, 0x78, // 1911 0x86, 0xA5, 0x96, 0xa5, 0x96, 0x97, 0x88, 0x78, 0x78, 0x69, 0x78, 0x87, // 1912 0x95, 0xB4, 0x96, 0xA6, 0x97, 0x97, 0x78, 0x79, 0x79, 0x69, 0x78, 0x77, // 1913 0x96, 0xB4, 0x96, 0xa6, 0x97, 0x97, 0x79, 0x79, 0x79, 0x69, 0x78, 0x78, // 1914 0x96, 0xa5, 0x97, 0x96, 0x97, 0x87, 0x79, 0x79, 0x69, 0x69, 0x78, 0x78, // 1915 0x96, 0xa5, 0x96, 0xa5, 0x96, 0x97, 0x88, 0x78, 0x78, 0x79, 0x77, 0x87, // 1916 0x95, 0x96, 0x97, 0x78, 0x79, 0x78, 0x69, 0x78, 0x87, // 1917 0x96, 0x97, 0x97, 0x79, 0x79, 0x79, 0x69, 0x78, 0x77 , // 1918 0x96, 0xa5, 0x97, 0x96, 0x97, 0x87, 0x79, 0x79, 0x69, 0x69, 0x78, 0x78, // 1919 0x96, 0xa5, 0x96, 0xa5, 0x96, 0x97, 0x88, 0x78, 0x78, 0x79 , 0x77, 0x87, // 1920 0x95, 0xB4, 0x96, 0xA5, 0x96, 0x97, 0x78, 0x79, 0x78, 0x69, 0x78, 0x87, // 1921 0x96, 0x97, 0x96, 0xa6, 0x97, 0x97, 0x79,
0x79, 0x79, 0x69, 0x78, 0x77, // 1922 0x96, 0xA4, 0x96, 0x96, 0x97, 0x87, 0x79, 0x79, 0x69, 0x69, 0x78, 0x78, // 1923 0x96, 0xa5, 0x96, 0xa5, 0x96, 0x97, 0x88, 0x78, 0x78, 0x79, 0x77, 0x87, // 1924 0x95, 0x96, 0x96, 0xa5, 0x96, 0x97, 0x78, 0x79, 0x78, 0x69, 0x78, 0x87, // 1925 0x96, 0xB4, 0x96, 0xA6, 0x97, 0x97, 0x78, 0x79, 0x79, 0x69, 0x78, 0x77, // 1926 0x96, 0xa4, 0x96, 0x96, 0x97, 0x87, 0x79, 0x79, 0x79, 0x69, 0x78, 0x78, // 1927 0x96, 0xA5, 0x96, 0xa5, 0x96, 0x96, 0x88, 0x78, 0x78, 0x78, 0x87, 0x87, // 1928 0x95, 0x96, 0x97, 0x88, 0x78, 0x78, 0x79, 0x77, 0x87, / / 1929 0x96, 0xb4, 0x96, 0xa6, 0x97, 0x97, 0x78, 0x79, 0x79, 0x69, 0x78, 0x77, // 1930 0x96, 0xa4, 0x96, 0x96, 0x97, 0x87, 0x79, 0x79, 0x79, 0x69, 0x78 , 0x78, // 1931 0x96, 0xA5, 0x96, 0xa5, 0x96, 0x96, 0x88, 0x78, 0x78, 0x78, 0x87, 0x87, // 1932 0x95, 0x96, 0x97, 0x88, 0x78, 0x78 , 0x69, 0x78, 0x96, 0xb4, 0x96, 0xa6, 0x97, 0x97, 0x78, 0x79, 0x79, 0x69, 0x78, 0x77 , // 1934 0x96, 0xA4, 0x96, 0x96, 0x97, 0x97, 0x79, 0x79, 0x79, 0x69, 0x78, 0x78, // 1935 0x96, 0xa5, 0x96, 0xa5, 0x96, 0x96, 0x88, 0x78, 0x78, 0x78 , 0x87, 0x87, // 1936 0x95, 0x96, 0x97, 0x88, 0x78, 0x78, 0x69, 0x78, 0x87, // 1937 0X96, 0xB4, 0X96, 0XA6, 0x97, 0x97, 0x78, 0x79 , 0x79, 0x69, 0x78, 0x77, // 1938 0x96, 0xA4, 0x96, 0x96, 0x97, 0x97, 0x79, 0x79, 0x79, 0x69, 0x78, 0x78, // 1939 0x96, 0xa5, 0x96, 0xa5, 0x96, 0x96 , 0x88, 0x78, 0x78, 0x78, 0x87, 0x87, // 1940 0x95, 0x96, 0x97, 0x88, 0x78, 0x78, 0x69, 0x78, 0x87, // 1941 0x96, 0xB4, 0x96, 0xA6 , 0x97, 0x97, 0x78, 0x79, 0x79, 0x69, 0x78, 0x77, // 1942 0x96, 0xa4, 0x96, 0x96, 0x97, 0x97, 0x79, 0x79, 0x79, 0x69, 0x78, 0x78, // 1943 0x96,
0xA5, 0x96, 0xA5, 0xA6, 0x96, 0x88, 0x78, 0x78, 0x78, 0x87, 0x87, // 1944 0x95, 0x96, 0x97, 0x88, 0x78, 0x78, 0x79, 0x77, 0x87, / / 1945 0x95, 0xB4, 0x96, 0xA6, 0x97, 0x97, 0x78, 0x79, 0x78, 0x69, 0x78, 0x77, // 1946 0x96, 0x97, 0x97, 0x79, 0x79, 0x79, 0x69, 0x78 , 0x78, // 1947 0x96, 0xa5, 0xa6, 0xa5, 0xa6, 0x96, 0x88, 0x88, 0x78, 0x78, 0x87, 0x87, // 1948 0xa5, 0x96, 0x97, 0x88, 0x79, 0x78 , 0x79, 0x77, 0x87, // 1949 0x95, 0x96, 0x97, 0x78, 0x79, 0x78, 0x69, 0x78, 0x77, // 1950 0x96, 0xb4, 0x96, 0xa6, 0x97, 0x97, 0x79 , 0x79, 0x79, 0x69, 0x78, 0x78, // 1951 0x96, 0xa5, 0xa6, 0xa5, 0xa6, 0x96, 0x88, 0x88, 0x78, 0x78, 0x87, 0x87, // 1952 0xa5, 0xB4, 0x96, 0xa5, 0x96 , 0x97, 0x88, 0x78, 0x78, 0x79, 0x77, 0x87, // 1953 0x95, 0x96, 0x96, 0xa5, 0x96, 0x97, 0x78, 0x79, 0x78, 0x68, 0x78, 0x87, // 1954 0x96, 0xB4, 0x96 , 0xA6, 0x97, 0x97, 0x78, 0x79, 0x79, 0x69, 0x78, 0x77, // 1955 0x96, 0xa5, 0xa5, 0xa5, 0xa6, 0x96 , 0x88, 0x88, 0x78, 0x78, 0x87, 0x87, // 1956 0xa5, 0x96, 0x97, 0x88, 0x78, 0x78, 0x79, 0x77, 0x87, // 1957 0x95, 0xB4, 0x96, 0xa5 , 0x96, 0x97, 0x88, 0x78, 0x78, 0x69, 0x78, 0x87, // 1958 0x96, 0x7, 0x96, 0xa6, 0x97, 0x97, 0x78, 0x79, 0x79, 0x69, 0x78, 0x77, // 1959 0x96, 0xa4 , 0xa5, 0xa5, 0xa6, 0x96, 0x88, 0x88, 0x88, 0x78, 0x87, 0x87, // 1960 0xa5, 0xB4, 0x96, 0xA5, 0x96, 0x96, 0x88, 0x78, 0x78, 0x78, 0x87, 0x87, // 1961 0x96, 0x5, 0x96, 0x97, 0x88, 0x78, 0x78, 0x69, 0x78, 0x87, // 1962 0x96, 0x97, 0x97, 0x78, 0x79, 0x79, 0x69, 0x78, 0x77, // 1963 0x96, 0xa4, 0xa5, 0xa5, 0xa6, 0x96, 0x88, 0x88, 0x88, 0x78, 0x87, 0x87, // 1964 0xa5, 0x96, 0x96, 0x88, 0x78, 0x78,
0x78, 0x87, 0x87, // 1965 0x95, 0x96, 0x97, 0x88, 0x78, 0x78, 0x69, 0x78, 0x87, // 1966 0x96, 0x97, 0x96, 0xa6, 0x97, 0x97, 0x78, 0x79, 0x79, 0x69, 0x78, 0x77, // 1967 0x96, 0xa4, 0xa5, 0x88, 0xa6, 0xa6, 0x88, 0x88, 0x88, 0x78, 0x87, 0x87, // 1968 0XA5, 0X96, 0x96, 0x88, 0x78, 0x78, 0x78, 0x87, 0x87, // 1969 0x95, 0x96, 0x96, 0xa5, 0x96, 0x97, 0x88, 0x78, 0x78, 0x69, 0x78, 0x87, // 1970 0x96, 0xB4, 0x96, 0xA6, 0x97, 0x97, 0x78, 0x79, 0x79, 0x69, 0x78, 0x77, // 1971 0X96, 0XA4, 0XA5, 0XA5, 0XA6, 0XA6, 0X88, 0X88, 0X88, 0X78, 0X87, 0X87, / / 1972 0XA5, 0xB5, 0x96, 0xA5, 0xA6, 0x96, 0x88, 0x78, 0x78, 0x78, 0x87, 0x87, // 1973 0x95, 0x96, 0x96, 0xa5, 0x96, 0x97, 0x88, 0x78, 0x78, 0x69, 0x78, 0x87, / / 1974 0x96, 0xB4, 0x96, 0xA6, 0x97, 0x97, 0x78, 0x79, 0x78, 0x69, 0x78, 0x77, // 1975 0x96, 0xa4, 0xa5, 0x88, 0xa6, 0xa6, 0x88, 0x89, 0x88, 0x78, 0x87 , 0x87, // 1976 0xa5, 0xB4, 0x96, 0xA5, 0x96, 0x96, 0x88, 0x88, 0x78, 0x78, 0x87, 0x87, // 1977 0 X95, 0xB4, 0x96, 0xA5, 0x96, 0x97, 0x88, 0x78, 0x78, 0x79, 0x78, 0x87, // 1978 0x96, 0x96, 0x97, 0x78, 0x79, 0x78, 0x69, 0x78, 0x77 , // 1979 0x96, 0xA4, 0xA5, 0x888, 0x88, 0x88, 0x78, 0x87, 0x87, // 1980 0xa5, 0xa6, 0x96, 0x88, 0x888, 0x78, 0x78 , 0x77, 0x87, // 1981 0x95, 0x96, 0x97, 0x88, 0x78, 0x78, 0x79, 0x77, 0x87, // 1982 0x95, 0xB4, 0x96, 0xa5, 0x96, 0x97, 0x78, 0x79 , 0x78, 0x69, 0x78, 0x77, // 1983 0x96, 0xa6, 0xa6, 0x87, 0x88, 0x88, 0x78, 0x87, 0x87, // 1984 0xa5, 0xa6, 0x96 , 0x88, 0x88, 0x78, 0x78, 0x87, 0x87, // 1985 0xa5, 0x96, 0x97, 0x88, 0x78, 0x78, 0x79, 0x77, 0x87, // 1986 0x95, 0xB4, 0x96,
0xA5, 0x96, 0x97, 0x88, 0x79, 0x78, 0x69, 0x78, 0x87, // 1987 0x96, 0xa6, 0xa6, 0x87, 0x88, 0x88, 0x78, 0x87, 0x86, // 1988 0xa5, 0xB4, 0xA5, 0xA5, 0xA6, 0x96, 0x88, 0x88, 0x88, 0x78, 0x87, 0x87, // 1989 0xa5, 0x96, 0x96, 0x88, 0x78, 0x78, 0x79, 0x77, 0x87, / / 1990 0x95, 0xb4, 0x96, 0xa5, 0x86, 0x97, 0x88, 0x78, 0x78, 0x69, 0x78, 0x87, // 1991 0x96, 0xA6, 0xa5, 0x87, 0x888, 0x88, 0x78, 0x87 , 0x86, // 1992 0xa5, 0xa6, 0x96, 0x88, 0x88, 0x88, 0x78, 0x87, 0x87, // 1993 0xa5, 0x96, 0x96, 0x888, 0x78, 0x78 , 0x78, 0x87, 0x87, // 1994 0x95, 0x96, 0x97, 0x88, 0x76, 0x78, 0x69, 0x78, 0x87, // 1995 0x96, 0xa6, 0xa5, 0x, 0xa6, 0xa6, 0x87 , 0x88, 0x88, 0x78, 0x87, 0x86, // 1996 0XA5, 0XA6, 0XA5, 0XA5, 0XA6, 0XA6, 0X88, 0X88, 0X88, 0X78, 0X87, 0x87, // 1997 0xa5, 0xb4, 0x96, 0xa5, 0x96 , 0x96, 0x88, 0x78, 0x78, 0x78, 0x87, 0x87, // 1998 0x95, 0xB4, 0x96, 0xa5, 0x96, 0x97, 0x88, 0x78 , 0x78, 0x69, 0x78, 0x87, // 1999 0x96, 0xa6, 0xa6, 0x87, 0x88, 0x88, 0x78, 0x87, 0x86, // 2000 0xa5, 0x, 0xa5, 0xa5, 0xa6, 0xa6 , 0x88, 0x88, 0x88, 0x78, 0x87, 0x87, // 2001 0xa5, 0x96, 0x96, 0x88, 0x78, 0x78, 0x78, 0x87, 0x87, // 2002 0x95, 0xb4, 0x96, 0xa5 , 0x96, 0x97, 0x88, 0x78, 0x78, 0x69, 0x78, 0x87, // 2003 0x96, 0xa6, 0xa5, 0x87, 0x88, 0x88, 0x78, 0x87, 0x86, // 2004 0XA5, 0XB3 , 0xa5, 0xa5, 0xa6, 0xa6, 0x88, 0x88, 0x88, 0x78, 0x87, 0x87, // 2005 0xa5, 0xa6, 0x96, 0xa5, 0xa6, 0x96, 0x88, 0x88, 0x78, 0x78, 0x87, 0x87, // 2006 0x95, 0x96, 0x97, 0x88, 0x78, 0x78, 0x69, 0x78, 0x87, // 2007 0x96, 0xa6, 0xa6, 0x87, 0x88, 0x87, 0x78, 0x87,
0x86, // 2008 0xa5, 0xa6, 0xa6, 0x88, 0x88, 0x88, 0x78, 0x87, 0x87, // 2009 0xa5, 0xa6, 0x96, 0xa5, 0xa6, 0x96, 0x88, 0x88, 0x78, 0x78, 0x87, 0x87, // 2010 0x95, 0xb4, 0x96, 0xa5, 0x96, 0x97, 0x88, 0x78, 0x78, 0x79, 0x78, 0x87, // 2011 0x96, 0xb4, 0xa5, 0x, 0x, 0xa5, 0xa6, 0x87, 0x88, 0x87, 0x78, 0x87, 0x86, // 2012 0xa5, 0xb3, 0xa5, 0x87, 0x88, 0x88, 0x78, 0x87, 0x87, // 2013 0xa5, 0x, 0x96, 0xa5, 0xa6, 0x96, 0x88, 0x88, 0x78, 0x78, 0x87, 0x87, // 2014 0x95, 0x96, 0x97, 0x88, 0x78, 0x78, 0x79, 0x77, 0x87, // 2015 0x95, 0xB4, 0xA5, 0xB4, 0xA5, 0xA6, 0x87, 0x88, 0x87, 0x78, 0x87, 0x86, // 2016 0xa5, 0xA6, 0xA6, 0x87, 0x88, 0x88, 0x78, 0x87, 0x87, // 2017 0xa5, 0xB4, 0xA6, 0xA5, 0xA6, 0x96, 0x88, 0x88, 0x78, 0x78, 0x87, 0x87, // 2018 0xa5, 0x96, 0x96, 0x88, 0x96, 0x96, 0x88, 0x78, 0x78, 0x79, 0x77, 0x87, / / 2019 0x95, 0xB4, 0XA5, 0XB4, 0XA5, 0XA6, 0X97, 0X87, 0x87, 0x78, 0x87, 0x86, // 2020 0xa5, 0xc3, 0 XA5, 0XB5, 0XA6, 0XA6, 0X87, 0X88, 0X88, 0X78, 0X87, 0X86, // 2021 0XA5, 0XA6, 0X9, 0XA5, 0XA6, 0X96, 0X88, 0X88, 0X88, 0X78, 0X87, 0x87, // 2022 0xa5, 0x96, 0x96, 0x88, 0x78, 0x78, 0x79, 0x77, 0x87, // 2023 0x95, 0xa5, 0xa5, 0x97, 0x87, 0x87, 0x78, 0x87, 0x96 , // 2024 0xA5, 0xc3, 0xa5, 0x87, 0x88, 0x88, 0x78, 0x87, 0x86, // 2025 0XA5, 0XA6, 0XA5, 0XA5, 0XA6, 0XA6, 0X88, 0X88, 0X88, 0X78 , 0x87, 0x87, // 2026 0xa5, 0x96, 0x96, 0x88, 0x78, 0x78, 0x78, 0x87, 0x87, // 2027 0x95, 0xa5, 0xa5, 0x97, 0x87 , 0x87, 0x78, 0x87, 0x96, // 2028 0xa5, 0xc3, 0xa5, 0x, 0x87, 0x88, 0x88, 0x78, 0x87, 0x86, // 2029 0xa5, 0x, 0xa5, 0xa5, 0xa6,
0xA6, 0x88, 0x88, 0x88, 0x78, 030 0xa5, 0x96, 030 0xa5, 0x96, 0x96, 0x88, 0x78, 0x78, 0x78, 0x87, 0x87, // 2031 0x95, 0xB4, 0xA5, 0xB4, 0xA5, 0xA6, 0x97, 0x87, 0x87, 0x78, 0x87, 0x96, // 2032 0XA5, 0XA6, 0XA5, 0X888, 0XA6, 0XA6, 0X88, 0X88, 0X88, 0x78, 0x87, 0x86, // 2033 0XA5, 0xB3, 0xA5, 0xA5, 0xA6, 0xA6, 0x88, 0x78, 0x88, 0x78, 0x87, 0x87, // 2034 0xa5, 0xa6, 0x96, 0xa5, 0xa6, 0x96, 0x88, 0x88, 0x78, 0x78, 0x87, 0x87, / / 2035 0x95, 0xB4, 0xA5, 0X97, 0XA5, 0XA6, 0X97, 0X87, 0x87, 0x78, 0x87, 0x96, // 2036 0XA5, 0XC3, 0XA5, 0X87, 0X888, 0x88, 0x78, 0x87 , 0x86, // 2037 0xa5, 0xa6, 0xa6, 0x88, 0x88, 0x88, 0x78, 0x87, 0x87, // 2038 0xa5, 0x, 0xA6, 0x96, 0x88, 0x88, 0x78 , 0x78, 0x87, 0x87, // 2039 0x95, 0xa5, 0xa6, 0x97, 0x87, 0x87, 0x78, 0x87, 0x96, // 2040 0XA5, 0XC3, 0XA5, 0XB5, 0XA5, 0XA6, 0X87 , 0x88, 0x87, 0x78, 0x87, 0x86, // 2041 0XA5, 0XB3, 0XA5, 0xB5, 0XA6, 0XA6, 0X88, 0X88, 0X88, 0X78 , 0x87, 0x87, // 2042 0xa5, 0xa6, 0x96, 0x88, 0x88, 0x78, 0x78, 0x87, 0x87, // 2043 0x95, 0xa5, 0xa6, 0x97, 0x87 , 0x87, 0x88, 044 0xa5, 0xc3, 0xa5, 0x, 0x87, 0x88, 0x87, 0x78, 0x87, 0x86, // 2045 0XA5, 0XA6, 0XA6, 0xA6 , 0x87, 0x88, 0x88, 0x78, 046 0xa5, 0xa6, 0x96, 0xa5, 0xa6, 0x96, 0x88, 0x88, 0x78, 0x78, 0x87, 0x87, // 2047 0x95, 0xB4, 0XA5, 0XB4 , 0xa5, 0xa5, 0x97, 0x87, 0x87, 0x88, 048 0xa4, 0xc3, 0xa5, 0xa5, 0xa5, 0xa6, 0x97, 0x87, 0x87, 0x78, 0x87, 0x86, // 2049 0XA5, 0XC3 , 0xA5, 0xB5, 0xA6, 0xA6, 0x87, 0x88, 0x78, 0x78, 0x87,
0x87}; // 2050 private date {get {return m_date;} set {m_date = value;}} public cndate ()}} public cndate ()}} public cndate ()}} public cndate ()}} public cndate ()}} public cndate ()}} public cndate ()} .Date;} // calculate the constellation of the specified date Public Int getConstellation () {int y, m, d; y = m_date.year; m = m_date.Month; d = m_date.day; y = m * 100 D ; If ((Y> = 321) && (Y <= 419))) {RETURN 0;} else IF (Y> = 420) && (Y <= 520)) {RETURN 1;} else IF Y> = 521) && (y <= 620)) {RETURN 2;} else IF ((y> = 621) && (y <= 722)) {RETURN 3;} else if ((y> = 723) && (Y <= 822)) {RETURN 4;} else if (y> = 823) && (y <= 922)) {RETURN 5;} else if ((y> = 923) && (y <= 1022) ) {RETURN 6;} else IF ((y> = 1023) && (y <= 1121)) {RETURN 7;} else if ((y> = 1122) && (y <= 1221)) {RETURN 8;} ELSE IF (Y> = 1222) || (Y <= 119)) {RETURN 9;} else IF (Y> = 120) && (Y <= 218)) {Return 10;} else IF (Y > = 219) && (y <= 320)) {RETURN 11;} else {return -1 };} // calculate the constellation of the specified date Public string getConstellationName () {int cabletellation; constellation = getConstellation (); if ((constellation> = 0) && (constellation <= 11)) {Return ConstellationName [constellation]; } Else {return "";};} // Corresponding to the hollow 0-23, -1 is not a throttle public int L_getlunarholday () {byte flag; int day, iodiear, imth,
Iday; iodage; if ((iYear
Iday; int I; timeespan ts; Iyear = (ushort); if (iYear
Low; int it; if (iLunaryear
UINT ISPAndays) {uint tmp; // Cumulative calendar February 19, 1901, for the lunar calendar 1901, first month, first month, January 1 to February 19, February 19th, 49 days, IF (ISPANDAYS <49) {Iyear = start_year - 1; IF (ISPANDAYS <19) {IMONTH = 11; IDAY = (Ushort);} else {im thermy = 12; iday = (ushort);} return;} // below From the lunar calendar 1901, ISPANDAYS = ISPANDAYS - 49; IYEAR = Start_Year; IMONTH = 1; iDay = 1; // Computing Year TMP = (uint) LunaryEardAys (IYEAR); while (ispandays> = TMP) {ISPandAys = ISPANDAYS - TMP; IYEAR ; TMP = (uint) LunaryEardAys (Iyear);} // calculation month TMP = lunarmonthdays (IYEAR, IMONTH); // Take low WHILE (ISPANDAYS> = TMP) {IFAYS = ISPANDAYS - TMP; if (IMONTH == Getleapmonth (Iyear)) {TMP = (IyearMontHDAYS (Iyear, IMONTH) >> 16) & 0xfff; // Take high IF (ISPANDAYS 1); strYear = strsyear "year"; return strinoear;}} // class cndate public class test {static void main (string [] args) {cndate dt = new cndate (DateTime.today); console.writeline Today is: " DT.date.toString () DT.GetConstellationName ()); console.writeLine (DT.L_Getlunarholday ()); console.writeLine ()); console.writeline (" 月 " Dt.getleapmonth (uint16.parse))); console.writeline ("Number of February" DT.LunarmontHDAYS (uint16.parse (args [0]), uint16.parse (args [1]) )); Console.writeline ("Number of days" DT.LunaryEardAys (uint16.parse (args [0]))); console.writeline (" DT.FormatLunaryEar ()); dt.date = datetime.today.Adddays (1); console.writeline ("Tomorrow is:" DT.date.toString () DT.GetConstellationName ());}} // Class test} Author Blog: http://blog.9cbs.net/hycapril/