C # lunar calendar

xiaoxiao2021-03-06  92

Using system;

Namespace CNCALENDAR

{

Public class csy

{

Private const ushort start_year = 1901;

Private const usort end_year = 2050;

Private string [] constellationname =

{

"Aries", "Taurus", "Sublock",

"Cancer", "Leo", "Virgin",

"Libra", "Scorpio", "Shot",

"Capricorn", "Aquarius", "Pisces"};

Private string [] lunarholdayname =

{

"Small Cold", "Big Han", "Li Spring", "Rain Water",

"Shocked", "Spring", "Qingming", "Gu Yu",

"Lixia", "Small Man", "Mang", "Summer",

"Xiaoxie", "Da Summer", "Li Qiu", "Summer",

"Bai Lu", "Autumn", "Hanu", "Frost",

"Large Winter", "Snow", "Snow", "Winter"};

// The array of Glunarday deposits the number of monthly months of the annual annual annual 1901 to 2100.

// The lunar calendar can only be 29 or 30 days per month, with 12 (or 13) binary positions in one year, the corresponding position is 1 table 30 days, otherwise 29 days

Private int [] glunarmonthday = {

// Test data is only 1901.1.1 --2050.12.31

0x4ae0, 0xa570, 0x5268, 0x6a8, 0x56a0, 0x9ad0, 0x4ae8, 0x4ae0, // 1910

0xA4D8, 0xA4D0, 0XD250, 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, 0x5a8, 0x56a0, 0x96d0, // 1970

0x4ae8, 0x4ad0, 0xa4d0, 0xd268, 0xd250, 0xd528, 0x/40, 0xb6a0, 0x96d0, 0x95b0, // 1980

0x49b0, 0xa4b8, 0xa4b0, 0x6d40, 0xAda0, 0xAb60, 0x9370, 0x4978, // 19900x4970, 0x64b0, 0x6a50, 0x1a50, 0x6b28, 0x5ac0, 0xAb60, 0x9368, 0x92e0, 0xc960, // 2000

0xD4A8, 0xD4A0, 0XDA50, 0x5AA8, 0x56A0, 0xAAD8, 0x25D0, 0x92D0, 0XC958, 0XA950, / / ​​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, 0XADA0, 0X6D20, 0XADA0, 0X555B0}; // 2050

// A number of Glanarmonth stores the month of the lunar calendar from 1901 to 2050, if it is 0, two years for each word

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, 0xB0, 0x06, 0x00, 0x50, // 2040

0x02, 0x07, 0x00, 0x50, 0x03}; // 2050

// A number of Glanarholiday stores the twenty-four hollow calendar

/ / The number of twenty-four hollow cautions per year is almost fixed, and the average is distributed in 12 months.

// January 200 1 April April June

// Small cold, cold, spring, rain, thrilling, Spring, clear, Ying, Yue, Xia, Xiaomang, summer

// July August September, Octobermber December

// Xiaoshu Da Summer Autumn Summer White Lu Autumn Different Cold Cream Forte Winter Snow Snow Winter

// ******************************************************** ***************************************

// The throttle has no determination rules, so there is only a lacked table, saving space, so ....

// ******************************************************** ****************************************}

// Data format Description:

/ /, Such as the throttle of 1901

// January September April June 7, September September, September, September, September, September, September, September, September, 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 hollow corresponding date, 15 minus the first holiday, and the second holiday will be reduced 15 second line.

// This monthly two flying corresponding data is less than 16, stored in one byte every month, store the first throttle data, low storage

// Second, the second hollow data can be obtained

Byte [] glunarholday = {

0x96, 0x7, 0x96, 0xa6, 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, 0x7, 0x96, 0xa6, 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, 0x7, 0x96, 0xa6, 0x97, 0x97, 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, 0x7, 0x96, 0xa6, 0x97, 0x97, 0x78, 0x79, 0x79, 0x69, 0x78, 0x77, // 1913

0x96, 0x7, 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, 0x7, 0x96, 0xa6, 0x96, 0x97, 0x78, 0x79, 0x78, 0x69, 0x78, 0x87, // 1917

0x96, 0x97, 0x97, 0x79, 0x79, 0x79, 0x69, 0x78, 0x77, // 19180x96, 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, 0x7, 0x96, 0xa5, 0x96, 0x97, 0x78, 0x79, 0x78, 0x69, 0x78, 0x87, // 1921

0x96, 0x7, 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, 0x7, 0x96, 0xa5, 0x96, 0x97, 0x78, 0x79, 0x78, 0x69, 0x78, 0x87, // 1925

0x96, 0x7, 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, 0x5, 0x96, 0xa5, 0x96, 0x97, 0x88, 0x78, 0x78, 0x79, 0x77, 0x87, // 1929

0x96, 0x7, 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, 0x9, 0x96, 0xa5, 0x96, 0x97, 0x88, 0x78, 0x78, 0x69, 0x78, 0x87, // 1933

0x96, 0x7, 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, 0x88, 0x96, 0xa5, 0x96, 0x97, 0x88, 0x78, 0x78, 0x69, 0x78, 0x87, // 1937

0x96, 0x7, 0x96, 0xa6, 0x97, 0x97, 0x78, 0x79, 0x79, 0x69, 0x78, 0x77, // 1938

0x96, 0xA4, 0x96, 0x96, 0x97, 0x97, 0x79, 0x79, 0x79, 0x69, 0x78, 0x78, // 19390x96, 0xa5, 0x96, 0xa5, 0x96, 0x96, 0x88, 0x78, 0x78, 0x78, 0x87, 0x87, // 1940

0x95, 0x9, 0x96, 0xa5, 0x96, 0x97, 0x88, 0x78, 0x78, 0x69, 0x78, 0x87, // 1941

0x96, 0x7, 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, 0xB4, 0x96, 0xA5, 0x96, 0x97, 0x88, 0x78, 0x78, 0x79, 0x77, 0x87, // 1945

0x95, 0x7, 0x96, 0xa6, 0x97, 0x97, 0x78, 0x79, 0x78, 0x69, 0x78, 0x77, // 1946

0x96, 0xB4, 0x96, 0xA6, 0x97, 0x97, 0x79, 0x79, 0x79, 0x69, 0x78, 0x78, // 1947

0x96, 0xa5, 0xa6, 0xa5, 0xa6, 0x96, 0x88, 0x88, 0x78, 0x78, 0x87, 0x87, // 1948

0xA5, 0xB4, 0X96, 0XA5, 0x96, 0x97, 0x88, 0x79, 0x78, 0x79, 0x77, 0x87, // 1949

0x95, 0x7, 0x96, 0xa5, 0x96, 0x97, 0x78, 0x79, 0x78, 0x69, 0x78, 0x77, // 1950

0x96, 0x7, 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, 0x9, 0x96, 0xa5, 0x96, 0x97, 0x88, 0x78, 0x78, 0x79, 0x77, 0x87, // 1953

0x95, 0x7, 0x96, 0xa5, 0x96, 0x97, 0x78, 0x79, 0x78, 0x68, 0x78, 0x87, // 1954

0x96, 0x7, 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, 0xB4, 0x96, 0xA5, 0x96, 0x97, 0x88, 0x78, 0x78, 0x79, 0x77, 0x87, // 1957

0x95, 0x9, 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, // 19600xa5, 0x96, 0x96, 0x88, 0x78, 0x78, 0x78, 0x87, 0x87, // 1961

0x96, 0x96, 0x97, 0x88, 0x78, 0x78, 0x69, 0x78, 0x87, // 1962

0x96, 0x9, 0x96, 0xa6, 0x97, 0x97, 0x78, 0x79, 0x79, 0x69, 0x78, 0x77, // 1963

0x96, 0xa4, 0xa5, 0xa5, 0xa6, 0x96, 0x88, 0x88, 0x88, 0x78, 0x87, 0x87, // 1964

0xA5, 0xB4, 0X96, 0XA5, 0x96, 0x96, 0x88, 0x78, 0x78, 0x78, 0x87, 0x87, // 1965

0x95, 0x9, 0x96, 0xa5, 0x96, 0x97, 0x88, 0x78, 0x78, 0x69, 0x78, 0x87, // 1966

0x96, 0x7, 0x96, 0xa6, 0x97, 0x97, 0x78, 0x79, 0x79, 0x69, 0x78, 0x77, // 1967

0x96, 0xA4, 0xa5, 0xa5, 0xa6, 0xa6, 0x88, 0x88, 0x88, 0x78, 0x87, 0x87, // 1968

0xA5, 0xB4, 0x96, 0xA5, 0x96, 0x96, 0x88, 0x78, 0x78, 0x78, 0x87, 0x87, // 1969

0x95, 0xB4, 0x96, 0xA5, 0x96, 0x97, 0x88, 0x78, 0x78, 0x69, 0x78, 0x87, // 1970

0x96, 0x7, 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, 0x9, 0x96, 0xa5, 0x96, 0x97, 0x88, 0x78, 0x78, 0x69, 0x78, 0x87, // 1974

0x96, 0x7, 0x96, 0xa6, 0x97, 0x97, 0x78, 0x79, 0x78, 0x69, 0x78, 0x77, // 1975

0x96, 0xA4, 0xA5, 0xB5, 0XA6, 0xA6, 0x88, 0x89, 0x88, 0x78, 0x87, 0x87, // 1976

0xA5, 0xB4, 0x96, 0xA5, 0x96, 0x96, 0x88, 0x88, 0x78, 0x78, 0x87, 0x87, // 1977

0x95, 0x9, 0x96, 0xa5, 0x96, 0x97, 0x88, 0x78, 0x78, 0x79, 0x78, 0x87, // 1978

0x96, 0x9, 0x96, 0xa6, 0x96, 0x97, 0x78, 0x79, 0x78, 0x69, 0x78, 0x77, // 1979

0x96, 0xA4, 0xA5, 0xB5, 0XA6, 0XA6, 0X88, 0X88, 0X88, 0X78, 0X87, 0X87, / / ​​1980

0xA5, 0xB4, 0X96, 0XA5, 0XA6, 0X96, 0X88, 0X88, 0X78, 0X78, 0X77, 0X87, // 19810x95, 0x96, 0x97, 0x88, 0x78, 0x78, 0x79, 0x77, 0x87, // 1982

0x95, 0x7, 0x96, 0xa5, 0x96, 0x97, 0x78, 0x79, 0x78, 0x69, 0x78, 0x77, // 1983

0x96, 0xB4, 0xA5, 0xB5, 0xA6, 0xA6, 0x87, 0x88, 0x88, 0x78, 0x87, 0x87, // 1984

0xA5, 0xA6, 0xA6, 0xA5, 0xA6, 0x96, 0x88, 0x88, 0x78, 0x78, 0x87, 0x87, // 1985

0xA5, 0x9, 0x96, 0xa5, 0x96, 0x97, 0x88, 0x78, 0x78, 0x79, 0x77, 0x87, // 1986

0x95, 0xB4, 0x96, 0xA5, 0x96, 0x97, 0x88, 0x79, 0x78, 0x69, 0x78, 0x87, // 1987

0x96, 0xB4, 0xA5, 0xB5, 0XA6, 0xA6, 0x87, 0x88, 0x88, 0x78, 0x87, 0x86, // 1988

0xA5, 0xA5, 0XA6, 0X96, 0X88, 0X88, 0X88, 0X78, 0X87, 0X87, / / ​​1989

0xA5, 0xB4, 0x96, 0xA5, 0x96, 0x96, 0x88, 0x78, 0x78, 0x79, 0x77, 0x87, // 1990

0x95, 0xB4, 0x96, 0xA5, 0x86, 0x97, 0x88, 0x78, 0x78, 0x69, 0x78, 0x87, // 1991

0x96, 0xb4, 0xa5, 0xb5, 0xa6, 0xa6, 0x87, 0x88, 0x88, 0x78, 0x87, 0x86, // 1992

0xA5, 0XB3, 0XA5, 0XA5, 0XA6, 0X96, 0X88, 0X88, 0X88, 0X78, 0X87, 0X87, / / ​​1993

0xA5, 0xB4, 0X96, 0XA5, 0x96, 0x96, 0x88, 0x78, 0x78, 0x78, 0x87, 0x87, // 1994

0x95, 0x9, 0x96, 0xa5, 0x96, 0x97, 0x88, 0x76, 0x78, 0x69, 0x78, 0x87, // 1995

0x96, 0xa6, 0xa5, 0x, 0x87, 0x88, 0x88, 0x78, 0x87, 0x86, // 1996

0xA5, 0xB3, 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, 0x5, 0x96, 0xa5, 0x96, 0x97, 0x88, 0x78, 0x78, 0x69, 0x78, 0x87, // 1999

0x96, 0xb4, 0xa5, 0xb5, 0xa6, 0xa6, 0x87, 0x88, 0x88, 0x78, 0x87, 0x86, // 2000

0xA5, 0xB3, 0XA5, 0XA5, 0XA6, 0XA6, 0X88, 0X88, 0X88, 0X78, 0X87, 0X87, / / ​​2001

0xa5, 0x96, 0x96, 0x88, 0x78, 0x78, 0x78, 0x87, 0x87, // 20020x95, 0x96, 0x97, 0x88, 0x78, 0x78, 0x69, 0x78, 0x87, // 2003

0x96, 0xB4, 0xA5, 0XB5, 0XA6, 0XA6, 0X87, 0x88, 0x88, 0x78, 0x87, 0x86, // 2004

0xA5, 0XB3, 0XA5, 0XA5, 0XA6, 0XA6, 0X88, 0X88, 0X88, 0X78, 0X87, 0X87, / / ​​2005

0xA5, 0xB4, 0x96, 0xA5, 0xA6, 0x96, 0x88, 0x88, 0x78, 0x78, 0x87, 0x87, // 2006

0x95, 0x9, 0x96, 0xa5, 0x96, 0x97, 0x88, 0x78, 0x78, 0x69, 0x78, 0x87, // 2007

0x96, 0xb4, 0xa5, 0xb5, 0xa6, 0xa6, 0x87, 0x88, 0x87, 0x78, 0x87, 0x86, // 2008

0xA5, 0xB3, 0XA5, 0XB5, 0XA6, 0XA6, 0X88, 0X88, 0X88, 0X78, 0X87, 0X87, / / ​​2009

0xA5, 0xB4, 0X96, 0XA5, 0XA6, 0x96, 0x88, 0x88, 0x78, 0x78, 0x87, 0x87, // 2010

0x95, 0x9, 0x96, 0xa5, 0x96, 0x97, 0x88, 0x78, 0x78, 0x79, 0x78, 0x87, // 2011

0x96, 0xb4, 0xa5, 0xb5, 0xa5, 0xa6, 0x87, 0x88, 0x87, 0x78, 0x87, 0x86, // 2012

0xA5, 0xB3, 0XA5, 0XB5, 0XA6, 0xA6, 0x87, 0x88, 0x88, 0x78, 0x87, 0x87, // 2013

0xA5, 0xB4, 0X96, 0XA5, 0XA6, 0x96, 0x88, 0x88, 0x78, 0x78, 0x87, 0x87, // 2014

0x95, 0x9, 0x96, 0xa5, 0x96, 0x97, 0x88, 0x78, 0x78, 0x79, 0x77, 0x87, // 2015

0x95, 0xB4, 0xA5, 0XB4, 0XA5, 0xA6, 0x87, 0x88, 0x87, 0x78, 0x87, 0x86, // 2016

0xa5, 0xc3, 0xa5, 0xb5, 0xa6, 0xa6, 0x87, 0x88, 0x88, 0x78, 0x87, 0x87, // 2017

0xA5, 0xA6, 0xA6, 0xA5, 0xA6, 0x96, 0x88, 0x88, 0x78, 0x78, 0x87, 0x87, // 2018

0xA5, 0xB4, 0x96, 0xA5, 0x96, 0x96, 0x88, 0x78, 0x78, 0x79, 0x77, 0x87, // 2019

0x95, 0xB4, 0xA5, 0xB4, 0XA5, 0xA6, 0x97, 0x87, 0x87, 0x78, 0x87, 0x86, // 2020

0xA5, 0xc3, 0xa5, 0xb5, 0xa6, 0xa6, 0x87, 0x88, 0x88, 0x78, 0x87, 0x86, // 2021

0xA5, 0xA5, 0xA6, 0x96, 0x88, 0x88, 0x88, 0x78, 0x87, 0x87, // 2022

0xa5, 0x96, 0x96, 0x88, 0x78, 0x78, 0x79, 0x77, 0x87, // 20230x95, 0x87, 0xa5, 0x97, 0x87, 0x87, 0x78, 0x87, 0x96, // 2024

0xA5, 0XC3, 0xA5, 0XB5, 0XA6, 0XA6, 0X87, 0X88, 0X88, 0X78, 0X87, 0X86, / / ​​2025

0xa5, 0xa6, 0xa5, 0xa5, 0xa6, 0xa6, 0x88, 0x88, 0x88, 0x78, 0x87, 0x87, // 2026

0xA5, 0xB4, 0x96, 0xA5, 0x96, 0x96, 0x88, 0x78, 0x78, 0x78, 0x87, 0x87, // 2027

0x95, 0xB4, 0xA5, 0xB4, 0xA5, 0xA6, 0x97, 0x87, 0x87, 0x78, 0x87, 0x96, // 2028

0xA5, 0xc3, 0xa5, 0xB5, 0xA6, 0xA6, 0x87, 0x88, 0x88, 0x78, 0x87, 0x86, // 2029

0xA5, 0xA5, 0XA5, 0XA5, 0XA6, 0XA6, 0X88, 0X88, 0X88, 0X78, 0X87, 0X87, / / ​​2030

0xa5, 0x96, 0x96, 0x88, 0x78, 0x78, 0x78, 0x87, 0x87, // 2031

0x95, 0xa5, 0xA6, 0x97, 0x87, 0x87, 0x78, 0x87, 0x96, // 2032

0xA5, 0xc3, 0xa5, 0xb5, 0xa6, 0xa6, 0x88, 0x88, 0x88, 0x78, 0x87, 0x86, // 2033

0xA5, 0xB3, 0XA5, 0XA5, 0XA6, 0XA6, 0X88, 0X78, 0X88, 0X78, 0X87, 0X87, / / ​​2034

0xA5, 0xB4, 0X96, 0XA5, 0XA6, 0x96, 0x88, 0x88, 0x78, 0x78, 0x87, 0x87, // 2035

0x95, 0xa5, 0xa6, 0x97, 0x87, 0x87, 0x78, 0x87, 0x96, // 2036

0xa5, 0xc3, 0xa5, 0xb5, 0xa6, 0xa6, 0x87, 0x88, 0x88, 0x78, 0x87, 0x86, // 2037

0xA5, 0xA5, 0xA5, 0XA5, 0XA6, 0xA6, 0x88, 0x88, 0x88, 0x78, 0x87, 0x87, // 2038

0xA5, 0xB4, 0X96, 0XA5, 0XA6, 0X96, 0X88, 0x88, 0x78, 0x78, 0x87, 0x87, // 2039

0x95, 0xB4, 0xA5, 0xB4, 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, 0xB4, 0X96, 0XA5, 0XA6, 0x96, 0x88, 0x88, 0x78, 0x78, 0x87, 0x87, // 2043

0x95, 0xa5, 0xa6, 0x97, 0x87, 0x87, 0x88, 0x87, 0x96, // 20440xa5, 0xc3, 0xa5, 0x87, 0xa5, 0xa6, 0x87, 0x88, 0x87, 0x78, 0x87, 0x86, // 2045

0xA5, 0xB3, 0XA5, 0XB5, 0XA6, 0XA6, 0X87, 0X88, 0X88, 0X78, 0X87, 0X87, / / ​​2046

0xA5, 0xB4, 0X96, 0XA5, 0XA6, 0x96, 0x88, 0x88, 0x78, 0x78, 0x87, 0x87, // 2047

0x95, 0xA5, 0xA5, 0x97, 0x87, 0x87, 0x88, 0x86, 0x96, // 2048

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 M_Date;

Public DateTime Date

{

Get {return m_date;}

Set {m_date = value;}

}

Public csy ()

{

Date = datetime.toDay;

}

Public CNDATE (DateTime DT)

{

Date = DT.DATE;

}

// calculate the constellation serial number 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 name of the constellation of the specified date

Public string getConstellationName ()

{

Int constellation;

Constellation = getConstellation ();

IF (Constellation> = 0) && (constellation <= 11)))

{RETURN ConstellationName [constellation];

Else

{Return "";

}

// Calculate the throttle 0-23, -1 in the day calendar, is not a throttle

Public int L_Getlunarholday ()

{

BYTE flag;

Int Day, Iyear, IMONTH, IDAY;

Iyear = m_date.year;

IF (iYear End_Year))

{RETURN -1;

IMONTH = M_DATE.MONTH;

iDay = m_date.day;

Flag = GlunarholdAy [(Iyear - start_year) * 12 IMONTH - 1];

IF (iDay <15)

{Day = 15 - ((Flag >> 4) & 0x0f);

Else

{Day = (flag & 0x0f) 15;

IF (iDay == day)

{

IF (iDay> 15)

{RETURN (IMONTH - 1) * 2 1;}

Else

{RETURN (IMONTH - 1) * 2;

}

Else

{RETURN -1;

}

Public String FormatMonth (Ushort Imh, Bool Blunar)

{

String sztext = "Zheng two three four five six seven eight nine ten";

String strmonth;

IF ((! Blunar) && (iMonth == 1)))

{RETURN "January";

IF (IMONTH <= 10)

{

Strmonth = "";

Strmonth = strmonth sztext.substring (IMONTH - 1, 1);

Strmonth = strmonth "month";

Return strmonth;

}

IF (IMONTH == 11)

{strmonth = "11";

Else

{strmonth = "twelve";

Return strMonth "Month";

}

Public String FormatLunarday (Ushort iDay)

{

String sztext1 = "Early 10th";

String sztext2 = "One or two three four five six seven eight nine ten";

String strday;

IF ((iDay! = 20) && (iDay! = 30)))

{

STRDAY = Sztext1.substring ((iDay - 1) / 10, 1);

STRDAY = strDay sztext2.substring ((iDay - 1)% 10, 1);}

Else

{

STRDAY = sztext1.substring ((iDay / 10) * 2 1, 2);

strDay = strDay "Ten";

}

Return strday;

}

Public string getlunarholday ()

{

Ushort Iyear, IMONTH, IDAY;

INT I;

Timespan TS;

Iyear = (ushort) (m_date.year);

IF (iYear End_Year))

{Return "";

i = l_getlunarholday ();

IF ((i> = 0) && (i <= 23))

{Return LunarholdAyName [i];

Else

{

Ts = m_date - (New DateTime (start_year, 1, 1));

L_CalClunardate (Out Iyear, Out IMONTH, OUT iDAY, (TS.DAYS));

Return FormatMonth (IMONTH, TRUE) FormatLunarday (iDay);

}

}

// Return the lunar month of the 阴 历 i 年e, if there is no return 0 from January 1901 - December 2050

Public int Getleapmonth (Ushort iLunaryear)

{

BYTE flag;

IF ((ilunaryear End_Year))

{RETURN 0;};

Flag = Glunarmonth [(ilunaryear - start_year) / 2];

IF ((ilunaryear - start_year)% 2 == 0)

{RETURN FLAG >> 4;

Else

{RETURN FLAG & 0x0F;}

}

// Return the number of lunar calendar iLunaryer years, if ilunarmonth is the month,

// High-character is the second iLunarmonTH day, otherwise high words are 0 1901 - December 2050

Public uint lunarmonthdays (ushort ilunaryear, ushort ilunarmonth)

{

INT Height, Low;

INT IBIT;

IF ((ilunaryear End_Year))

{RETURN 30;

HEIGHT = 0;

Low = 29;

Ibit = 16 - ilunarmonth;

IF ((Ilunarmonth> Getleapmonth (iLunaryear) && (GetleapMonth (iLunaryear)> 0))

{ibit--;}

IF ((Glunarmonthday [ilunaryear - start_year] & (1 << ibit))> 0)

{Low ;}

IF (ilunarmonth == getleapmonth (ilunaryear))

{

IF ((glunarmonthday [ilunaryear - start_year] & (1 << (iBIT-1)))> 0) {height = 30;

Else

{Height = 29;}

}

Return (UINT) ((UINT) (HEIGHT) << 16); // combined with UIT

}

// Return the total number of days in the lunar calendar Ilunaryear, January 1901 - December 2050

Public Int LunaryEardAys (Ushort Ilunaryear)

{

Int days;

UINT TMP;

IF ((ilunaryear End_Year))

{RETURN 0;};

Days = 0;

For (Ushort I = 1; i <= 12; i )

{

TMP = lunarmonthdays (ilunaryear, i);

Days = days ((Ushort) (TMP >> 16) & 0xfff); // Take a high level

Days = days (usort) (TMP); // Take a low position

}

Return day;

}

// Calculate the valence date from ISPANDAYS in January 1, 1901

Public void l_calclunardate (Out Ushort Iyear, Out Ushort IMONTH, OUT USHORT iDAY, UINT ISPANDAYS)

{

UINT TMP;

// Ceremony February 19, 1901 is the first month of the first month of the lunar calendar 1901

// Soluk calendar from 1 January to February 19, 1901, 49 days

IF (ISPANDAYS <49)

{

Iyear = start_year - 1;

IF (ISPANDAYS <19)

{

IMONTH = 11;

IDAY = (Ushort) (11 ispandays);

}

Else

{

IMONTH = 12;

Iday = (ushort) (ISPANDAYS - 18);

}

Return;

}

// The following from the lunar calendar in the first month of the first month of the first month

ISPANDAYS = ISPANDAYS - 49;

Iyear = start_year;

IMONTH = 1;

iDay = 1;

// calculate the year

TMP = (uint) LunaryEardAys (Iyear);

While (ispandays> = TMP)

{

ISPANDAYS = ISPANDAYS - TMP;

Iyear ;

TMP = (uint) LunaryEardAys (Iyear);

}

// calculate the month

TMP = lunarmonthdays (iodar, iMonth); // Take low

While (ispandays> = TMP)

{

ISPANDAYS = ISPANDAYS - TMP;

IF (IMONTH == Getleapmonth (Iyear))

{

TMP = (iYearMontHDAYS (Iyear, IMONTH) >> 16) & 0xfff; // Take high

IF (ISPANDAYS

{Break;

ISPANDAYS = ISPANDAYS - TMP;

}

IMONTH ;

TMP = lunarmonthdays (iodar, iMonth); // Take low

}

// Computing Day

IDAY = (iShort) (iDay ispandays);

// Format the Iyear Year into the string representation

Public string formatlunaryear ()

{

String stryear;

String sztext1 = "methyl isthyl 丁 丁 庚 庚 壬";

String sztext2 = "The child is ugly";

String sztext3 = "Mouse Niuhu Dragon Snake Sagar Monkey Chicken Chicken Pig";

Ushort Iyear;

Iyear = (ushort) (m_date.year);

Stryear = sztext1.substring ((iYear - 4)% 10, 1);

Stryear = streyear sztext2.substring (iYear - 4)% 12, 1);

strYear = strYear ""

Stryear = streyear sztext3.substring (iYear - 4)% 12, 1);

Stryear = strsyear "year";

Return strsyear;

}

} // 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 (DT.Getlunarholday ());

Console.writeline ("Leap Moon" Dt.getleapmonth (uint16.parse (args [0])))

Console.writeline ("February" DT.Lunarmonthdays (uint16.parse (args [0]), uint16.parse (args [1]));

Console.writeLine ("Number of days" DT.LunaryEardAys (uint16.parse)))

Console.writeLine (" DT.FormatLunaryEar ());

Dt.date = datetime.today.adddays (1);

Console.writeline ("Tomorrow is:" DT.Date.Tostring () DT.GetConstellationName ());

}

} // Class Test

}

转载请注明原文地址:https://www.9cbs.com/read-122446.html

New Post(0)