├── java ├── lunar │ ├── .gitignore │ ├── resources │ │ ├── T1901c.txt │ │ ├── T1902c.txt │ │ ├── T1903c.txt │ │ ├── T1904c.txt │ │ ├── T1905c.txt │ │ ├── T1906c.txt │ │ ├── T1907c.txt │ │ ├── T1908c.txt │ │ ├── T1909c.txt │ │ ├── T1910c.txt │ │ ├── T1911c.txt │ │ ├── T1912c.txt │ │ ├── T1913c.txt │ │ ├── T1914c.txt │ │ ├── T1915c.txt │ │ ├── T1916c.txt │ │ ├── T1917c.txt │ │ ├── T1918c.txt │ │ ├── T1919c.txt │ │ ├── T1920c.txt │ │ ├── T1921c.txt │ │ ├── T1922c.txt │ │ ├── T1923c.txt │ │ ├── T1924c.txt │ │ ├── T1925c.txt │ │ ├── T1926c.txt │ │ ├── T1927c.txt │ │ ├── T1928c.txt │ │ ├── T1929c.txt │ │ ├── T1930c.txt │ │ ├── T1931c.txt │ │ ├── T1932c.txt │ │ ├── T1933c.txt │ │ ├── T1934c.txt │ │ ├── T1935c.txt │ │ ├── T1936c.txt │ │ ├── T1937c.txt │ │ ├── T1938c.txt │ │ ├── T1939c.txt │ │ ├── T1940c.txt │ │ ├── T1941c.txt │ │ ├── T1942c.txt │ │ ├── T1943c.txt │ │ ├── T1944c.txt │ │ ├── T1945c.txt │ │ ├── T1946c.txt │ │ ├── T1947c.txt │ │ ├── T1948c.txt │ │ ├── T1949c.txt │ │ ├── T1950c.txt │ │ ├── T1951c.txt │ │ ├── T1952c.txt │ │ ├── T1953c.txt │ │ ├── T1954c.txt │ │ ├── T1955c.txt │ │ ├── T1956c.txt │ │ ├── T1957c.txt │ │ ├── T1958c.txt │ │ ├── T1959c.txt │ │ ├── T1960c.txt │ │ ├── T1961c.txt │ │ ├── T1962c.txt │ │ ├── T1963c.txt │ │ ├── T1964c.txt │ │ ├── T1965c.txt │ │ ├── T1966c.txt │ │ ├── T1967c.txt │ │ ├── T1968c.txt │ │ ├── T1969c.txt │ │ ├── T1970c.txt │ │ ├── T1971c.txt │ │ ├── T1972c.txt │ │ ├── T1973c.txt │ │ ├── T1974c.txt │ │ ├── T1975c.txt │ │ ├── T1976c.txt │ │ ├── T1977c.txt │ │ ├── T1978c.txt │ │ ├── T1979c.txt │ │ ├── T1980c.txt │ │ ├── T1981c.txt │ │ ├── T1982c.txt │ │ ├── T1983c.txt │ │ ├── T1984c.txt │ │ ├── T1985c.txt │ │ ├── T1986c.txt │ │ ├── T1987c.txt │ │ ├── T1988c.txt │ │ ├── T1989c.txt │ │ ├── T1990c.txt │ │ ├── T1991c.txt │ │ ├── T1992c.txt │ │ ├── T1993c.txt │ │ ├── T1994c.txt │ │ ├── T1995c.txt │ │ ├── T1996c.txt │ │ ├── T1997c.txt │ │ ├── T1998c.txt │ │ ├── T1999c.txt │ │ ├── T2000c.txt │ │ ├── T2001c.txt │ │ ├── T2002c.txt │ │ ├── T2003c.txt │ │ ├── T2004c.txt │ │ ├── T2005c.txt │ │ ├── T2006c.txt │ │ ├── T2007c.txt │ │ ├── T2008c.txt │ │ ├── T2009c.txt │ │ ├── T2010c.txt │ │ ├── T2011c.txt │ │ ├── T2012c.txt │ │ ├── T2013c.txt │ │ ├── T2014c.txt │ │ ├── T2015c.txt │ │ ├── T2016c.txt │ │ ├── T2017c.txt │ │ ├── T2018c.txt │ │ ├── T2019c.txt │ │ ├── T2020c.txt │ │ ├── T2021c.txt │ │ ├── T2022c.txt │ │ ├── T2023c.txt │ │ ├── T2024c.txt │ │ ├── T2025c.txt │ │ ├── T2026c.txt │ │ ├── T2027c.txt │ │ ├── T2028c.txt │ │ ├── T2029c.txt │ │ ├── T2030c.txt │ │ ├── T2031c.txt │ │ ├── T2032c.txt │ │ ├── T2033c.txt │ │ ├── T2034c.txt │ │ ├── T2035c.txt │ │ ├── T2036c.txt │ │ ├── T2037c.txt │ │ ├── T2038c.txt │ │ ├── T2039c.txt │ │ ├── T2040c.txt │ │ ├── T2041c.txt │ │ ├── T2042c.txt │ │ ├── T2043c.txt │ │ ├── T2044c.txt │ │ ├── T2045c.txt │ │ ├── T2046c.txt │ │ ├── T2047c.txt │ │ ├── T2048c.txt │ │ ├── T2049c.txt │ │ ├── T2050c.txt │ │ ├── T2051c.txt │ │ ├── T2052c.txt │ │ ├── T2053c.txt │ │ ├── T2054c.txt │ │ ├── T2055c.txt │ │ ├── T2056c.txt │ │ ├── T2057c.txt │ │ ├── T2058c.txt │ │ ├── T2059c.txt │ │ ├── T2060c.txt │ │ ├── T2061c.txt │ │ ├── T2062c.txt │ │ ├── T2063c.txt │ │ ├── T2064c.txt │ │ ├── T2065c.txt │ │ ├── T2066c.txt │ │ ├── T2067c.txt │ │ ├── T2068c.txt │ │ ├── T2069c.txt │ │ ├── T2070c.txt │ │ ├── T2071c.txt │ │ ├── T2072c.txt │ │ ├── T2073c.txt │ │ ├── T2074c.txt │ │ ├── T2075c.txt │ │ ├── T2076c.txt │ │ ├── T2077c.txt │ │ ├── T2078c.txt │ │ ├── T2079c.txt │ │ ├── T2080c.txt │ │ ├── T2081c.txt │ │ ├── T2082c.txt │ │ ├── T2083c.txt │ │ ├── T2084c.txt │ │ ├── T2085c.txt │ │ ├── T2086c.txt │ │ ├── T2087c.txt │ │ ├── T2088c.txt │ │ ├── T2089c.txt │ │ ├── T2090c.txt │ │ ├── T2091c.txt │ │ ├── T2092c.txt │ │ ├── T2093c.txt │ │ ├── T2094c.txt │ │ ├── T2095c.txt │ │ ├── T2096c.txt │ │ ├── T2097c.txt │ │ ├── T2098c.txt │ │ ├── T2099c.txt │ │ ├── T2100c.txt │ │ └── data_downloader.sh │ ├── .idea │ │ ├── vcs.xml │ │ ├── .gitignore │ │ ├── encodings.xml │ │ ├── modules.xml │ │ ├── misc.xml │ │ ├── libraries │ │ │ ├── Maven__junit_junit_4_13_1.xml │ │ │ ├── Maven__com_google_code_gson_gson_2_8_5.xml │ │ │ ├── Maven__org_hamcrest_hamcrest_core_1_3.xml │ │ │ ├── Maven__commons_codec_commons_codec_1_11.xml │ │ │ ├── Maven__commons_logging_commons_logging_1_2.xml │ │ │ ├── Maven__org_apache_commons_commons_lang3_3_11.xml │ │ │ ├── Maven__org_apache_httpcomponents_httpcore_4_4_11.xml │ │ │ └── Maven__org_apache_httpcomponents_httpclient_4_5_7.xml │ │ ├── compiler.xml │ │ └── jarRepositories.xml │ ├── src │ │ ├── test │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── github │ │ │ │ └── heqiao2010 │ │ │ │ └── lunar │ │ │ │ ├── LunarUtilsTest.java │ │ │ │ ├── test │ │ │ │ ├── RangeTest.java │ │ │ │ ├── AddByLunarTest.java │ │ │ │ ├── LocalTest.java │ │ │ │ ├── JuheTest.java │ │ │ │ ├── HkOTest.java │ │ │ │ └── DateInfoCollector.java │ │ │ │ └── TestLunarSolar.java │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── github │ │ │ └── heqiao2010 │ │ │ └── lunar │ │ │ ├── LunarUtils.java │ │ │ ├── LunarCodes.java │ │ │ ├── LunarCalendar.java │ │ │ └── LunarData.java │ ├── .project │ ├── .classpath │ ├── lunar.iml │ └── pom.xml ├── lunardemo │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── github │ │ │ └── heqiao2010 │ │ │ └── lunar │ │ │ └── demo │ │ │ ├── LunarDemo.java │ │ │ └── LunarValidate.java │ └── pom.xml └── README.md ├── go └── LunarCalendar │ ├── go.mod │ ├── .idea │ ├── vcs.xml │ ├── modules.xml │ └── LunarCalendar.iml │ └── lunar_calendar │ ├── LunarCodes.go │ └── LunarData.go └── README.md /java/lunar/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /go/LunarCalendar/go.mod: -------------------------------------------------------------------------------- 1 | module lunar_calendar 2 | 3 | go 1.12 4 | 5 | require ( 6 | // nothing 7 | ) -------------------------------------------------------------------------------- /java/lunar/resources/T1901c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1901c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1902c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1902c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1903c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1903c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1904c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1904c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1905c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1905c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1906c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1906c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1907c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1907c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1908c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1908c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1909c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1909c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1910c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1910c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1911c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1911c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1912c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1912c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1913c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1913c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1914c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1914c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1915c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1915c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1916c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1916c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1917c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1917c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1918c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1918c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1919c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1919c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1920c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1920c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1921c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1921c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1922c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1922c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1923c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1923c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1924c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1924c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1925c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1925c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1926c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1926c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1927c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1927c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1928c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1928c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1929c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1929c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1930c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1930c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1931c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1931c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1932c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1932c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1933c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1933c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1934c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1934c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1935c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1935c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1936c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1936c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1937c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1937c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1938c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1938c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1939c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1939c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1940c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1940c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1941c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1941c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1942c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1942c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1943c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1943c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1944c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1944c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1945c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1945c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1946c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1946c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1947c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1947c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1948c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1948c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1949c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1949c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1950c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1950c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1951c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1951c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1952c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1952c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1953c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1953c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1954c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1954c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1955c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1955c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1956c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1956c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1957c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1957c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1958c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1958c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1959c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1959c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1960c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1960c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1961c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1961c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1962c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1962c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1963c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1963c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1964c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1964c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1965c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1965c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1966c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1966c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1967c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1967c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1968c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1968c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1969c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1969c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1970c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1970c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1971c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1971c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1972c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1972c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1973c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1973c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1974c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1974c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1975c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1975c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1976c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1976c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1977c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1977c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1978c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1978c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1979c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1979c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1980c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1980c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1981c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1981c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1982c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1982c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1983c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1983c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1984c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1984c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1985c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1985c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1986c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1986c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1987c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1987c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1988c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1988c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1989c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1989c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1990c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1990c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1991c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1991c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1992c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1992c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1993c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1993c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1994c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1994c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1995c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1995c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1996c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1996c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1997c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1997c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1998c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1998c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T1999c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T1999c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2000c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2000c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2001c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2001c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2002c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2002c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2003c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2003c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2004c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2004c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2005c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2005c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2006c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2006c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2007c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2007c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2008c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2008c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2009c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2009c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2010c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2010c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2011c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2011c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2012c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2012c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2013c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2013c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2014c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2014c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2015c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2015c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2016c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2016c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2017c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2017c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2018c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2018c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2019c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2019c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2020c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2020c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2021c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2021c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2022c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2022c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2023c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2023c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2024c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2024c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2025c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2025c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2026c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2026c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2027c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2027c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2028c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2028c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2029c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2029c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2030c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2030c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2031c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2031c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2032c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2032c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2033c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2033c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2034c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2034c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2035c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2035c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2036c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2036c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2037c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2037c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2038c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2038c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2039c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2039c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2040c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2040c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2041c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2041c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2042c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2042c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2043c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2043c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2044c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2044c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2045c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2045c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2046c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2046c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2047c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2047c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2048c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2048c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2049c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2049c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2050c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2050c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2051c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2051c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2052c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2052c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2053c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2053c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2054c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2054c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2055c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2055c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2056c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2056c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2057c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2057c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2058c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2058c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2059c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2059c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2060c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2060c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2061c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2061c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2062c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2062c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2063c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2063c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2064c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2064c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2065c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2065c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2066c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2066c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2067c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2067c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2068c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2068c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2069c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2069c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2070c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2070c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2071c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2071c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2072c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2072c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2073c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2073c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2074c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2074c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2075c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2075c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2076c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2076c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2077c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2077c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2078c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2078c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2079c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2079c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2080c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2080c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2081c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2081c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2082c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2082c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2083c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2083c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2084c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2084c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2085c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2085c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2086c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2086c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2087c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2087c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2088c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2088c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2089c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2089c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2090c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2090c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2091c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2091c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2092c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2092c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2093c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2093c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2094c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2094c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2095c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2095c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2096c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2096c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2097c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2097c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2098c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2098c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2099c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2099c.txt -------------------------------------------------------------------------------- /java/lunar/resources/T2100c.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heqiao2010/LunarCalendar/HEAD/java/lunar/resources/T2100c.txt -------------------------------------------------------------------------------- /java/lunar/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /go/LunarCalendar/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /java/lunar/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Datasource local storage ignored files 5 | /dataSources/ 6 | /dataSources.local.xml 7 | # Editor-based HTTP Client requests 8 | /httpRequests/ 9 | -------------------------------------------------------------------------------- /java/lunar/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /java/lunar/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /go/LunarCalendar/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /java/lunar/src/test/java/com/github/heqiao2010/lunar/LunarUtilsTest.java: -------------------------------------------------------------------------------- 1 | package com.github.heqiao2010.lunar; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertEquals; 6 | 7 | public class LunarUtilsTest { 8 | 9 | @Test 10 | public void lengthOfMonth() { 11 | assertEquals(30, LunarUtils.lengthOfMonth(2020, 12, false)); 12 | } 13 | } -------------------------------------------------------------------------------- /go/LunarCalendar/.idea/LunarCalendar.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /java/lunar/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /java/lunar/resources/data_downloader.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # description: 从香港天文台网站下载 1901-2100期间的日历对照信息 4 | # see: https://www.hko.gov.hk/tc/gts/time/conversion1_text.htm 5 | 6 | readonly begin_year=1901 7 | readonly end_year=2100 8 | 9 | set +e 10 | 11 | echo "begin download data..." 12 | for((year=begin_year;year<=end_year;year++)); 13 | do 14 | echo "download $year.txt" 15 | curl -O "https://www.hko.gov.hk/tc/gts/time/calendar/text/files/T${year}c.txt" 16 | done 17 | echo "done." 18 | -------------------------------------------------------------------------------- /java/lunar/.idea/libraries/Maven__junit_junit_4_13_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /java/lunar/.idea/libraries/Maven__com_google_code_gson_gson_2_8_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /java/lunar/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /java/lunar/.idea/libraries/Maven__commons_codec_commons_codec_1_11.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /java/lunar/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | lunar 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | -------------------------------------------------------------------------------- /java/lunar/.idea/libraries/Maven__commons_logging_commons_logging_1_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /go/LunarCalendar/lunar_calendar/LunarCodes.go: -------------------------------------------------------------------------------- 1 | package lunar_calendar 2 | 3 | // GetMonthCodes 农历年的代码数组 4 | func GetMonthCodes(year int32) []uint32 { 5 | return lunarInfo[year-MiniYear] 6 | } 7 | 8 | // GetCodeYear 从代码中获取年份,大于12时表示下一年 9 | func GetCodeYear(code uint32) uint32 { 10 | if code/100 > 12 { 11 | return 1 12 | } 13 | return 0 14 | } 15 | 16 | // GetCodeMonth 从代码中获取农历月初一在公历中的月份 17 | func GetCodeMonth(code uint32) uint32 { 18 | month := code / 100 19 | if month > 12 { 20 | month -= 12 21 | } 22 | return month 23 | } 24 | 25 | // GetCodeDay 从代码中获取农历日在公历中的日 (day of month) 26 | func GetCodeDay(code uint32) uint32 { 27 | return code % 100 28 | } 29 | -------------------------------------------------------------------------------- /java/lunar/.idea/libraries/Maven__org_apache_commons_commons_lang3_3_11.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /java/lunar/.idea/libraries/Maven__org_apache_httpcomponents_httpcore_4_4_11.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /java/lunar/.idea/libraries/Maven__org_apache_httpcomponents_httpclient_4_5_7.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /java/lunar/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /java/lunar/src/test/java/com/github/heqiao2010/lunar/test/RangeTest.java: -------------------------------------------------------------------------------- 1 | package com.github.heqiao2010.lunar.test; 2 | 3 | import com.github.heqiao2010.lunar.LunarCalendar; 4 | import org.junit.Test; 5 | 6 | import java.util.Calendar; 7 | 8 | public class RangeTest { 9 | 10 | @Test(expected = IllegalArgumentException.class) 11 | public void rangeTest() { 12 | // 2021年没有腊月三十 13 | LunarCalendar lunar = new LunarCalendar(2021, 12, 30, false); 14 | System.out.println(lunar); 15 | Calendar today = LunarCalendar.lunar2Solar(lunar.getLunarYear(), lunar.getLunarMonth(), lunar.getDayOfLunarMonth(), lunar.isLeapMonth()); 16 | System.out.println(lunar.getFullLunarName() + " <====> " + today.getTime()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 中国农历 2 | 中国农历支持公历日期和农历日期之间的相互转化,支持获取年份的生肖以及天干地支表示;支持公历范围为:1850-02-12到2150-12-31。 3 | 4 | 本着简单,逻辑清晰的原则,核心类只实现基本的日期转化功能。 5 | 6 | ## 关于数据的验证 7 | 目前从公历范围:1901-01-01到2100-12-31 的数据是经过验证的,验证的依据是香港天文台提供的 8 | [公历农历对照表](https://www.hko.gov.hk/tc/gts/time/conversion1_text.htm)。 9 | 10 | 超出此范围的数据验证可以对比其他数据,比如手机APP日历或者第三方API等。 11 | 12 | # 语言支持 13 | 14 | 支持的语言列表如下: 15 | - [java](https://github.com/heqiao2010/LunarCalendar/tree/master/java) 16 | - [js](https://github.com/wvv8oo/lunar) 17 | - golang 18 | - python 19 | - c++ 20 | 21 | ## Source Code 22 | 23 | - [LunarCalendar](https://github.com/heqiao2010/LunarCalendar) 24 | 25 | 26 | ## Credits 27 | 28 | - [heqiao2010](https://github.com/heqiao2010) 29 | 30 | ## 受conis用JS实现的lunar启发 31 | [conis用JS实现的lunar](http://github.com/conis/lunar) 32 | -------------------------------------------------------------------------------- /java/lunardemo/src/main/java/com/github/heqiao2010/lunar/demo/LunarDemo.java: -------------------------------------------------------------------------------- 1 | package com.github.heqiao2010.lunar.demo; 2 | 3 | import com.github.heqiao2010.lunar.LunarCalendar; 4 | 5 | import java.util.Calendar; 6 | 7 | public class LunarDemo { 8 | public static void main(String[] args) { 9 | // 公历转农历: 10 | Calendar today = Calendar.getInstance(); 11 | LunarCalendar lunar = LunarCalendar.solar2Lunar(today); 12 | System.out.println(today.getTime() + " <====> " + lunar.getFullLunarName()); 13 | 14 | // 农历转公历: 15 | LunarCalendar lunar1 = new LunarCalendar(); 16 | Calendar today1 = LunarCalendar.lunar2Solar(lunar.getLyear(), lunar.getLmonth(), lunar.getLdate(), 17 | lunar.isLeapMonth()); 18 | System.out.println(lunar1.getFullLunarName() + " <====> " + today1.getTime()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /java/lunar/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /java/lunar/.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | -------------------------------------------------------------------------------- /java/lunardemo/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.heqiao2010 8 | lunar-demo 9 | 1.0-SNAPSHOT 10 | 11 | 12 | 13 | com.github.heqiao2010 14 | lunar 15 | 1.4 16 | 17 | 18 | 19 | org.apache.httpcomponents 20 | httpclient 21 | 4.5.13 22 | test 23 | 24 | 25 | org.apache.httpcomponents 26 | httpclient 27 | 4.5.13 28 | compile 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /java/lunar/lunar.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /java/README.md: -------------------------------------------------------------------------------- 1 | # 中国农历 2 | 中国农历的Java实现,本着简洁的原则,用一个Java类不到1000行,不依赖任何第三方库实现。 3 | 4 | 支持公历范围为:1850-02-12到2150-12-31范围内,农历日期和公历日期的转换。支持获取年份的生肖以及天干地支表示。 5 | 6 | ## 用法 7 | 直接下载源码或者导入依赖。 8 | 9 | stable-version=1.2 10 | 11 | latest-version=1.4 12 | 13 | maven: 14 | 15 | ``` 16 | 17 | com.github.heqiao2010 18 | lunar 19 | {latest-version} 20 | 21 | ``` 22 | 23 | gradle: 24 | 25 | ``` 26 | compile("com.github.heqiao2010:lunar:{latest-version}") 27 | ``` 28 | 29 | 示例: 30 | 公历转农历: 31 | 32 | ``` 33 | Calendar today = Calendar.getInstance(); 34 | LunarCalendar lunar = LunarCalendar.solar2Lunar(today); 35 | System.out.println(today.getTime() + " <====> " + lunar.getFullLunarName()); 36 | ``` 37 | 38 | 农历转公历: 39 | 40 | ``` 41 | LunarCalendar lunar = new LunarCalendar(); 42 | Calendar today = LunarCalendar.lunar2Solar(lunar.getLyear(), lunar.getLmonth(), lunar.getLdate(), lunar.isLeapMonth()); 43 | System.out.println(lunar.getFullLunarName() + " <====> " + today.getTime()); 44 | ``` 45 | 46 | ## 实现思路 47 | 通过记录1850年-2150年间的农历信息到二维数组中,经过查询和相关计算就能实现公历日期和农历日期之间的转化。 48 | 例如:
49 | { 8, 131, 301, 331, 429, 528, 627, 726, 825, 924, 1023, 1122, 1222, 1320 }, // 1900
50 | { 0, 219, 320, 419, 518, 616, 716, 814, 913, 1012, 1111, 1211, 1310 }, // 1901
51 | ... 52 | * 每个数组的第一个数表示该年闰月月份,为0表示不闰月. 53 | * 数组中其他数表示该月初一对应的公历日期. 54 | 55 | ## 关于数据的验证 56 | 目前从公历范围:1901-01-01到2100-12-31 的数据是经过验证的,验证的依据是香港天文台提供的 57 | [公历农历对照表](https://www.hko.gov.hk/tc/gts/time/conversion1_text.htm)。 58 | 59 | 超出此范围的数据验证可以对比其他数据,比如手机APP日历或者第三方API等。 60 | 61 | 62 | 63 | ## 公历农历对照表 64 | 见solar2lunar.txt 65 | 66 | * Solar:1900-01-31 <====> Lunar:一九〇〇年正月初一 庚子年 鼠 67 | * Solar:1900-02-01 <====> Lunar:一九〇〇年正月初二 庚子年 鼠 68 | * Solar:1900-02-02 <====> Lunar:一九〇〇年正月初三 庚子年 鼠 69 | * Solar:1900-02-03 <====> Lunar:一九〇〇年正月初四 庚子年 鼠 70 | * Solar:1900-02-04 <====> Lunar:一九〇〇年正月初五 庚子年 鼠 71 | * Solar:1900-02-05 <====> Lunar:一九〇〇年正月初六 庚子年 鼠 72 | * Solar:1900-02-06 <====> Lunar:一九〇〇年正月初七 庚子年 鼠 73 | * Solar:1900-02-07 <====> Lunar:一九〇〇年正月初八 庚子年 鼠 74 | * Solar:1900-02-08 <====> Lunar:一九〇〇年正月初九 庚子年 鼠 75 | * Solar:1900-02-09 <====> Lunar:一九〇〇年正月初十 庚子年 鼠 76 | * Solar:1900-02-10 <====> Lunar:一九〇〇年正月十一 庚子年 鼠 77 | * Solar:1900-02-11 <====> Lunar:一九〇〇年正月十二 庚子年 鼠 78 | * Solar:1900-02-12 <====> Lunar:一九〇〇年正月十三 庚子年 鼠 79 | * Solar:1900-02-13 <====> Lunar:一九〇〇年正月十四 庚子年 鼠 80 | * Solar:1900-02-14 <====> Lunar:一九〇〇年正月十五 庚子年 鼠 81 | * Solar:1900-02-15 <====> Lunar:一九〇〇年正月十六 庚子年 鼠 82 | * Solar:1900-02-16 <====> Lunar:一九〇〇年正月十七 庚子年 鼠 83 | * Solar:1900-02-17 <====> Lunar:一九〇〇年正月十八 庚子年 鼠 84 | * Solar:1900-02-18 <====> Lunar:一九〇〇年正月十九 庚子年 鼠 85 | * Solar:1900-02-19 <====> Lunar:一九〇〇年正月二十 庚子年 鼠 86 |
... 87 | 88 | ## Source Code 89 | 90 | - [LunarCalendar](https://github.com/heqiao2010/LunarCalendar) 91 | 92 | 93 | ## Credits 94 | 95 | - [heqiao2010](https://github.com/heqiao2010) 96 | 97 | ## 受conis用JS实现的lunar启发 98 | [conis用JS实现的lunar](http://github.com/conis/lunar) 99 | -------------------------------------------------------------------------------- /java/lunar/src/main/java/com/github/heqiao2010/lunar/LunarUtils.java: -------------------------------------------------------------------------------- 1 | package com.github.heqiao2010.lunar; 2 | 3 | import java.util.Calendar; 4 | 5 | public class LunarUtils { 6 | /** 7 | * 计算两个农历日期之差 8 | * 9 | * @param lc1  农历1 10 | * @param lc2  农历2 11 | * @param field  计算的维度,比如按月,天等 12 | * @return 具体的差值 13 | */ 14 | public static long luanrDiff(LunarCalendar lc1, LunarCalendar lc2, int field) { 15 | return solarDiff(lc1, lc2, field); 16 | } 17 | 18 | /** 19 | * 求两个公历日期之差,field可以为年月日,时分秒
20 | * 一年按365天计算,一个月按30天计算
21 | * 22 | * @param solar1  历日期 23 | * @param solar2  历日期 24 | * @param field 差值单位 25 | * @return 差值 26 | */ 27 | public static long solarDiff(Calendar solar1, Calendar solar2, int field) { 28 | long t1 = solar1.getTimeInMillis(); 29 | long t2 = solar2.getTimeInMillis(); 30 | switch (field) { 31 | case Calendar.SECOND: 32 | return (long) Math.rint((t1 - t2) / 1000.0); 33 | case Calendar.MINUTE: 34 | return (long) Math.rint((t1 - t2) / 60000.0); // 60 * 1000 35 | case Calendar.HOUR: 36 | return (long) Math.rint((t1 - t2) / 3600000.0); //3600 * 1000 37 | case Calendar.DATE: 38 | return (long) Math.rint((t1 - t2) / 86400000.0); // 24 * 3600 * 1000 39 | case Calendar.MONTH: 40 | return (long) Math.rint((t1 - t2) / 2592000000.0); // 30 * 24 * 3600 * 1000 41 | case Calendar.YEAR: 42 | return (long) Math.rint((t1 - t2) / 31536000000.0); // 365 * 24 * 3600 * 1000 43 | default: 44 | return -1; 45 | } 46 | } 47 | 48 | /** 49 | * 农历月的天数 50 | * 51 | * @param lunarYear 农历年 52 | * @param month 农历月 53 | * @param isLeapMonth 闰月 54 | * @return 天数,29或者30 55 | */ 56 | public static long lengthOfMonth(int lunarYear, int month, boolean isLeapMonth) { 57 | short[] codes = LunarCodes.monthCodes(lunarYear); 58 | int i = isLeapMonth ? month + 1 : month; 59 | if (codes[0] > 0 && month > codes[0]) i++; 60 | return LunarCodes.lengthOfMonth(lunarYear, month, codes[i]); 61 | } 62 | 63 | /** 64 | * 一个简单的二分查找,返回查找到的元素坐标,用于查找农历二维数组信息 65 | * 66 | * @param array  数组 67 | * @param n  待查询数字 68 | * @return 查到的坐标 69 | */ 70 | public static int binSearch(int[] array, int n) { 71 | if (null == array || array.length == 0) { 72 | return -1; 73 | } 74 | int min = 0, max = array.length - 1; 75 | if (n <= array[min]) { 76 | return min; 77 | } else if (n >= array[max]) { 78 | return max; 79 | } 80 | while (max - min > 1) { 81 | int newIndex = (max + min) / 2; // 二分 82 | if (array[newIndex] > n) { // 取小区间 83 | max = newIndex; 84 | } else if (array[newIndex] < n) {// 取大区间 85 | min = newIndex; 86 | } else { // 相等,直接返回下标 87 | return newIndex; 88 | } 89 | } 90 | if (array[max] == n) { 91 | return max; 92 | } else if (array[min] == n) { 93 | return min; 94 | } else { 95 | return min; // 返回 较小的一个 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /java/lunar/src/main/java/com/github/heqiao2010/lunar/LunarCodes.java: -------------------------------------------------------------------------------- 1 | package com.github.heqiao2010.lunar; 2 | 3 | import java.util.AbstractMap; 4 | import java.util.Calendar; 5 | import java.util.GregorianCalendar; 6 | import java.util.Map; 7 | 8 | import static com.github.heqiao2010.lunar.LunarData.LUNAR_INFO; 9 | 10 | /** 11 | * 农历/公历对照代码工具方法集合 12 | */ 13 | public class LunarCodes { 14 | 15 | /** 16 | * 农历年的代码数组 17 | * @param year 农历年 18 | * @return 代码数组 19 | */ 20 | public static short[] monthCodes(int year) { 21 | return LUNAR_INFO[year - LunarData.MINI_YEAR]; 22 | } 23 | 24 | /** 25 | * 从代码中获取年份,大于12时表示下一年 26 | * @param code 代码 27 | * @return 0/1 今年或者下一年 28 | */ 29 | public static int codeYear(int code) { 30 | return code / 100 > 12 ? 1 : 0; 31 | } 32 | 33 | /** 34 | * 从代码中获取农历月初一在公历中的月份 35 | * @param code 代码 36 | * @return 公历月份 37 | */ 38 | public static int codeMonth(int code) { 39 | int m = code / 100; 40 | if (m > 12) m -= 12; 41 | return m; 42 | } 43 | 44 | /** 45 | * 从代码中获取农历日在公历中的日 (day of month) 46 | * @param code 代码 47 | * @return 公历日 48 | */ 49 | public static int codeDay(int code) { 50 | return code % 100; 51 | } 52 | 53 | /** 54 | * 求一个农历月的天数 55 | * @param lunarYear 农历年 56 | * @param month 农历月 57 | * @param code 农历月有日期,Mdd 表示 58 | * @return 月的天数 59 | */ 60 | public static long lengthOfMonth(int lunarYear, int month, short code) { 61 | short md2; 62 | short[] starts = monthCodes(lunarYear); 63 | int y2 = lunarYear; 64 | if (month + 1 < starts.length && starts[month] == code) { 65 | md2 = starts[month + 1]; 66 | } else if (month + 2 < starts.length && starts[month + 1] == code) { 67 | md2 = starts[month + 2]; 68 | } else if (lunarYear - LunarData.MINI_YEAR + 1 < LUNAR_INFO.length) { 69 | md2 = monthCodes(lunarYear + 1)[1]; 70 | y2 ++; 71 | } else { 72 | throw new IllegalArgumentException("lunar date out of range"); 73 | } 74 | 75 | int y1 = lunarYear + codeYear(code); 76 | int m1 = codeMonth(code); 77 | int d1 = codeDay(code); 78 | 79 | y2 += codeYear(md2); 80 | int m2 = codeMonth(md2); 81 | int d2 = codeDay(md2); 82 | 83 | Calendar c1 = Calendar.getInstance(); 84 | c1.set(y1, m1 - 1, d1); 85 | Calendar c2 = Calendar.getInstance(); 86 | c2.set(y2, m2 - 1, d2); 87 | 88 | return LunarUtils.solarDiff(c2, c1, Calendar.DATE); 89 | } 90 | 91 | /** 92 | * 根据农历年和 LUNAR_INFO 中的下标来确定月份和闰月 93 | * 94 | * @param year 农历年 95 | * @param index LUNAR_INFO 月份数组中的下标 96 | * @return 月, 闰月 97 | */ 98 | public static Map.Entry month(int year, int index) { 99 | short[] a = monthCodes(year); 100 | int i = index; 101 | if (index == -1) { 102 | i = a.length - 1; 103 | } 104 | boolean isLeap = a[0] > 0 && a[0] + 1 == i; 105 | int month = isLeap || a[0] > 0 && a[0] < i ? i - 1 : i; 106 | return new AbstractMap.SimpleImmutableEntry(month, isLeap); 107 | } 108 | 109 | /** 110 | * 计算月份 Mdd 代码在数组中的位置 111 | * 112 | * @param year 农历年 113 | * @param month 农历月 114 | * @param isLeapMonth 闰月 115 | * @return 月所在的下标 116 | */ 117 | public static int monthIndex(int year, int month, boolean isLeapMonth) { 118 | short[] a = monthCodes(year); 119 | if (a[0] > 0 && a[0] < month || a[0] == month && isLeapMonth) { 120 | return month + 1; 121 | } 122 | return month; 123 | } 124 | 125 | /** 126 | * 判断两个整数所代表公历日期的差值
127 | * 一年按365天计算,一个月按30天计算
128 | * 129 | * @param solarCode1  农历日期代码 130 | * @param solarCode2  农历日期代码 131 | * @param field  差值单位 132 | * @return 差值 133 | */ 134 | public static long solarDateCodesDiff(int solarCode1, int solarCode2, int field) { 135 | GregorianCalendar c1 = new GregorianCalendar(solarCode1 / 10000, solarCode1 % 10000 / 100 - 1, 136 | solarCode1 % 10000 % 100); 137 | GregorianCalendar c2 = new GregorianCalendar(solarCode2 / 10000, solarCode2 % 10000 / 100 - 1, 138 | solarCode2 % 10000 % 100); 139 | return LunarUtils.solarDiff(c1, c2, field); 140 | } 141 | 142 | /** 143 | * 农历月的代码 144 | * @param lunarYear 农历月 145 | * @param lunarMonth 农历月 146 | * @param isLeapMonth 闰月 147 | * @return 代码 148 | */ 149 | public static short lunarMonthCode(int lunarYear, int lunarMonth, boolean isLeapMonth) { 150 | short[] codes = monthCodes(lunarYear); 151 | int index = lunarMonth; 152 | if (codes[0] > 0 && codes[0] < lunarMonth || codes[0] == lunarMonth && isLeapMonth) { 153 | index++; 154 | } 155 | return codes[index]; 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /java/lunar/src/test/java/com/github/heqiao2010/lunar/test/AddByLunarTest.java: -------------------------------------------------------------------------------- 1 | package com.github.heqiao2010.lunar.test; 2 | 3 | import com.github.heqiao2010.lunar.LunarCalendar; 4 | import com.github.heqiao2010.lunar.LunarCodes; 5 | import org.junit.Assert; 6 | import org.junit.Test; 7 | 8 | import java.util.Arrays; 9 | import java.util.Calendar; 10 | 11 | public class AddByLunarTest { 12 | @Test 13 | public void addByLunarMonth1() { 14 | final LunarCalendar lunar = new LunarCalendar(2020, 5, 20, false); 15 | Assert.assertEquals("二〇二〇年五月二十", lunar.toString()); 16 | lunar.addByLunar(Calendar.MONTH, 3); 17 | Assert.assertEquals("二〇二〇年八月二十", lunar.toString()); 18 | } 19 | 20 | /** 21 | * 闰月 22 | */ 23 | @Test 24 | public void addByLunarMonth11() { 25 | System.out.println(Arrays.toString(LunarCodes.monthCodes(2020))); 26 | final LunarCalendar lunar = new LunarCalendar(2020, 4, 20, false); 27 | Assert.assertEquals("二〇二〇年四月二十", lunar.toString()); 28 | lunar.addByLunar(Calendar.MONTH, 1); 29 | Assert.assertEquals("二〇二〇年闰四月二十", lunar.toString()); 30 | } 31 | 32 | /** 33 | * 闰月 34 | */ 35 | @Test 36 | public void addByLunarMonth12() { 37 | System.out.println(Arrays.toString(LunarCodes.monthCodes(2020))); 38 | final LunarCalendar lunar = new LunarCalendar(2020, 4, 20, true); 39 | Assert.assertEquals("二〇二〇年闰四月二十", lunar.toString()); 40 | lunar.addByLunar(Calendar.MONTH, -1); 41 | Assert.assertEquals("二〇二〇年四月二十", lunar.toString()); 42 | } 43 | 44 | /** 45 | * 2021年腊月没有三十 46 | */ 47 | @Test 48 | public void addByLunarMonth2() { 49 | final LunarCalendar lunar = new LunarCalendar(2021, 11, 30, false); 50 | Assert.assertEquals("二〇二一年冬月三十", lunar.toString()); 51 | lunar.addByLunar(Calendar.MONTH, 1); 52 | Assert.assertEquals("二〇二一年腊月廿九", lunar.toString()); 53 | } 54 | 55 | @Test 56 | public void addByLunarMonth3() { 57 | final LunarCalendar lunar = new LunarCalendar(2019, 12, 30, false); 58 | Assert.assertEquals("二〇一九年腊月三十", lunar.toString()); 59 | lunar.addByLunar(Calendar.MONTH, 1); 60 | Assert.assertEquals("二〇二〇年正月廿九", lunar.toString()); 61 | } 62 | 63 | @Test 64 | public void addByLunarMonth4() { 65 | final LunarCalendar lunar = new LunarCalendar(2020, 1, 1, false); 66 | Assert.assertEquals("二〇二〇年正月初一", lunar.toString()); 67 | lunar.addByLunar(Calendar.MONTH, 5); 68 | Assert.assertEquals("二〇二〇年五月初一", lunar.toString()); 69 | } 70 | 71 | @Test 72 | public void addByLunarMonth5() { 73 | final LunarCalendar lunar = new LunarCalendar(2020, 5, 1, false); 74 | Assert.assertEquals("二〇二〇年五月初一", lunar.toString()); 75 | lunar.addByLunar(Calendar.MONTH, -5); 76 | Assert.assertEquals("二〇二〇年正月初一", lunar.toString()); 77 | } 78 | 79 | @Test 80 | public void addByLunarMonth6() { 81 | final LunarCalendar lunar = new LunarCalendar(2020, 5, 1, false); 82 | Assert.assertEquals("二〇二〇年五月初一", lunar.toString()); 83 | lunar.addByLunar(Calendar.MONTH, -6); 84 | Assert.assertEquals("二〇一九年腊月初一", lunar.toString()); 85 | } 86 | 87 | @Test 88 | public void addByLunarMonth7() { 89 | final LunarCalendar lunar = new LunarCalendar(2020, 6, 1, false); 90 | System.out.println(Arrays.toString(LunarCodes.monthCodes(2020))); 91 | System.out.println(Arrays.toString(LunarCodes.monthCodes(2019))); 92 | System.out.println(Arrays.toString(LunarCodes.monthCodes(2018))); 93 | 94 | Assert.assertEquals("二〇二〇年六月初一", lunar.toString()); 95 | lunar.addByLunar(Calendar.MONTH, -19); 96 | Assert.assertEquals("二〇一八年腊月初一", lunar.toString()); 97 | } 98 | 99 | @Test 100 | public void addByLunarMonth8() { 101 | final LunarCalendar lunar = new LunarCalendar(2018, 12, 1, false); 102 | System.out.println(Arrays.toString(LunarCodes.monthCodes(2018))); 103 | System.out.println(Arrays.toString(LunarCodes.monthCodes(2019))); 104 | System.out.println(Arrays.toString(LunarCodes.monthCodes(2020))); 105 | 106 | Assert.assertEquals("二〇一八年腊月初一", lunar.toString()); 107 | lunar.addByLunar(Calendar.MONTH, 19); 108 | Assert.assertEquals("二〇二〇年六月初一", lunar.toString()); 109 | } 110 | 111 | @Test 112 | public void addByLunarYear1() { 113 | final LunarCalendar lunar = new LunarCalendar(2020, 12, 30, false); 114 | Assert.assertEquals("二〇二〇年腊月三十", lunar.toString()); 115 | lunar.addByLunar(Calendar.YEAR, 1); 116 | Assert.assertEquals("二〇二一年腊月廿九", lunar.toString()); 117 | } 118 | 119 | @Test 120 | public void addByLunarYear2() { 121 | final LunarCalendar lunar = new LunarCalendar(2020, 12, 30, false); 122 | Assert.assertEquals("二〇二〇年腊月三十", lunar.toString()); 123 | lunar.addByLunar(Calendar.YEAR, -1); 124 | Assert.assertEquals("二〇一九年腊月三十", lunar.toString()); 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /java/lunar/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | 8 | org.sonatype.oss 9 | oss-parent 10 | 7 11 | 12 | 13 | 14 | 15 | The Apache Software License, Version 2.0 16 | http://www.apache.org/licenses/LICENSE-2.0.txt 17 | repo 18 | 19 | 20 | 21 | https://github.com/heqiao2010 22 | https://github.com/heqiao2010/LunarCalendar.git 23 | 24 | 25 | 26 | Joel Herb 27 | he_qiao_2010@yeah.net 28 | heqiao2010 29 | 30 | 31 | 32 | UTF-8 33 | 34 | 35 | 36 | com.github.heqiao2010 37 | lunar 38 | 1.5 39 | 40 | LunarCalendar 41 | A Java implementation of Chinese lunar calendar. 42 | 43 | 44 | 45 | junit 46 | junit 47 | 4.13.1 48 | test 49 | 50 | 51 | 52 | com.google.code.gson 53 | gson 54 | 2.8.5 55 | test 56 | 57 | 58 | 59 | org.apache.httpcomponents 60 | httpclient 61 | 4.5.13 62 | test 63 | 64 | 65 | org.apache.commons 66 | commons-lang3 67 | 3.11 68 | test 69 | 70 | 71 | 72 | 73 | 74 | 75 | org.apache.maven.plugins 76 | maven-compiler-plugin 77 | 78 | 6 79 | 6 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | release 88 | 89 | 90 | 91 | 92 | org.apache.maven.plugins 93 | maven-source-plugin 94 | 2.2.1 95 | 96 | 97 | package 98 | 99 | jar-no-fork 100 | 101 | 102 | 103 | 104 | 105 | 106 | org.apache.maven.plugins 107 | maven-javadoc-plugin 108 | 2.9.1 109 | 110 | 111 | package 112 | 113 | jar 114 | 115 | 116 | 117 | 118 | 119 | 120 | org.apache.maven.plugins 121 | maven-gpg-plugin 122 | 1.6 123 | 124 | 125 | verify 126 | 127 | sign 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | oss 137 | https://oss.sonatype.org/content/repositories/snapshots/ 138 | 139 | 140 | oss 141 | https://oss.sonatype.org/service/local/staging/deploy/maven2/ 142 | 143 | 144 | 145 | 146 | 147 | -------------------------------------------------------------------------------- /java/lunar/src/test/java/com/github/heqiao2010/lunar/test/LocalTest.java: -------------------------------------------------------------------------------- 1 | package com.github.heqiao2010.lunar.test; 2 | 3 | import com.github.heqiao2010.lunar.LunarCalendar; 4 | import com.github.heqiao2010.lunar.LunarData; 5 | import com.github.heqiao2010.lunar.LunarUtils; 6 | import org.junit.Assert; 7 | import org.junit.Test; 8 | 9 | import java.io.*; 10 | import java.util.Calendar; 11 | 12 | /** 13 | * Created by heqiao on 2019/3/31. 14 | */ 15 | public class LocalTest { 16 | /** 17 | * 打印MINI_YEAR-01-31到MAX_YEAR-12-31所有的农历,并输出到txt中 18 | */ 19 | @Test 20 | public void localTest1(){ 21 | java.text.SimpleDateFormat df = new java.text.SimpleDateFormat("yyyy-MM-dd"); 22 | // start 23 | Calendar start = Calendar.getInstance(); 24 | start.set(Calendar.YEAR, LunarData.MINI_YEAR); 25 | start.set(Calendar.MONTH, LunarData.MINI_MONTH); 26 | start.set(Calendar.DATE, LunarData.MINI_DATE); 27 | // end 28 | Calendar end = Calendar.getInstance(); 29 | end.set(Calendar.YEAR, LunarData.MAX_YEAR); 30 | end.set(Calendar.MONTH, LunarData.MAX_MONTH); 31 | end.set(Calendar.DATE, LunarData.MAX_DATE); 32 | FileOutputStream out = null; 33 | PrintStream p = null; 34 | try { 35 | File testFile = new File("./resources/solar2lunar.txt"); 36 | if(!testFile.exists()){ 37 | testFile.createNewFile(); 38 | } 39 | out = new FileOutputStream(testFile); 40 | p = new PrintStream(out, true, "utf-8"); 41 | Calendar t = start; 42 | while(t.before(end) || t.equals(end)) { 43 | LunarCalendar lunar = LunarCalendar.solar2Lunar(t); 44 | System.out.println(df.format(t.getTime()) + " <====> " + lunar.getFullLunarName()); 45 | p.println(df.format(t.getTime()) + " <====> " + lunar.getFullLunarName()); 46 | t.add(Calendar.DATE, 1); 47 | } 48 | } catch (FileNotFoundException e) { 49 | System.out.println("未找到solar2lunar.txt文件,或者文件创建失败."); 50 | e.printStackTrace(); 51 | } catch (IOException e){ 52 | System.out.println("未找到solar2lunar.txt文件,或者文件创建失败."); 53 | e.printStackTrace(); 54 | }finally { 55 | try { 56 | out.close(); 57 | p.close(); 58 | } catch (IOException e) { 59 | System.out.println("关闭流出错。"); 60 | e.printStackTrace(); 61 | } 62 | } 63 | } 64 | 65 | @Test 66 | public void localTest2(){ 67 | final java.text.SimpleDateFormat df = new java.text.SimpleDateFormat("yyyy-MM-dd"); 68 | 69 | int lunarDay = 9; 70 | int lunarMonth = 12; 71 | int lunarYear = 1048; 72 | Assert.assertEquals("初九", LunarData.getDayName(lunarDay)); 73 | Assert.assertEquals('腊', LunarData.getMonthName(lunarMonth)); 74 | Assert.assertEquals("一〇四八", LunarData.getYearName(lunarYear)); 75 | 76 | Calendar c = Calendar.getInstance(); 77 | c.set(Calendar.YEAR, 2019); 78 | c.set(Calendar.MONTH, 2); 79 | c.set(Calendar.DATE, 31); 80 | LunarCalendar lunar = new LunarCalendar(c); 81 | System.out.println(df.format(c.getTime()) + " -> " + lunar); 82 | Assert.assertEquals("二〇一九年二月廿五", LunarData.getYearName(lunar.getLunarYear()) 83 | + "年" + lunar.getLunar(false)); 84 | 85 | Calendar c1 = Calendar.getInstance(); 86 | Calendar c2 = Calendar.getInstance(); 87 | System.out.println(df.format(c1.getTime())); 88 | c1.add(Calendar.MONTH, 10); 89 | System.out.println(df.format(c1.getTime())); 90 | // int[] arr1900 = { 8, 131, 301, 331, 429, 528, 627, 726, 825, 924, 1023, 1122, 1222, 1320 }; 91 | // System.out.println(LunarCalendar.binSearch(arr1900, 1121)); 92 | 93 | c1.set(Calendar.YEAR, 1991); 94 | c1.set(Calendar.MONTH, 3); 95 | c1.set(Calendar.DATE, 1); 96 | 97 | 98 | c2.set(Calendar.YEAR, 1991); 99 | c2.set(Calendar.MONTH, 2); 100 | c2.set(Calendar.DATE, 1); 101 | 102 | System.out.println(LunarUtils.solarDiff(c1, c2, Calendar.DATE)); 103 | System.out.println(df.format(c1.getTime())); 104 | System.out.println(df.format(c2.getTime())); 105 | } 106 | 107 | @Test 108 | public void localTest3(){ 109 | java.text.SimpleDateFormat df = new java.text.SimpleDateFormat("yyyy-MM-dd"); 110 | Calendar c1 = Calendar.getInstance(); 111 | 112 | c1.set(Calendar.YEAR, 2046); 113 | c1.set(Calendar.MONTH, 01); 114 | c1.set(Calendar.DATE, 06); 115 | LunarCalendar lunar = LunarCalendar.solar2Lunar(c1); 116 | System.out.println(); 117 | System.out.println("Solar:" + df.format(c1.getTime()) + "Lunar:" + lunar); 118 | } 119 | 120 | /** 121 | * 测试Set和Add 122 | */ 123 | @Test 124 | public void localTest4(){ 125 | java.text.SimpleDateFormat df = new java.text.SimpleDateFormat("yyyy-MM-dd"); 126 | Calendar c1 = Calendar.getInstance(); 127 | 128 | c1.set(Calendar.YEAR, 2020); 129 | c1.set(Calendar.MONTH, 2); 130 | c1.set(Calendar.DATE, 23); 131 | LunarCalendar lunar = LunarCalendar.solar2Lunar(c1); 132 | System.out.println("Solar:" + df.format(lunar.getTime()) + " Lunar:" + lunar); 133 | Assert.assertEquals("二〇二〇年二月三十", lunar.toString()); 134 | lunar.add(Calendar.DATE, 1); 135 | System.out.println(); 136 | System.out.println("Solar:" + df.format(lunar.getTime()) + " Lunar:" + lunar); 137 | Assert.assertEquals("二〇二〇年三月初一", lunar.toString()); 138 | 139 | lunar.add(Calendar.YEAR, 1); 140 | System.out.println("Solar:" + df.format(lunar.getTime()) + " Lunar:" + lunar); 141 | Assert.assertEquals("二〇二一年二月十二", lunar.toString()); 142 | 143 | lunar.set(Calendar.YEAR, 2019); 144 | lunar.set(Calendar.MONTH, 2); 145 | lunar.set(Calendar.DATE, 23); 146 | System.out.println("Solar:" + df.format(lunar.getTime()) + " Lunar:" + lunar); 147 | Assert.assertEquals("二〇一九年二月十七", lunar.toString()); 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /java/lunar/src/test/java/com/github/heqiao2010/lunar/test/JuheTest.java: -------------------------------------------------------------------------------- 1 | package com.github.heqiao2010.lunar.test; 2 | 3 | import com.github.heqiao2010.lunar.LunarCalendar; 4 | import com.github.heqiao2010.lunar.LunarData; 5 | import com.google.gson.Gson; 6 | import org.apache.http.client.methods.CloseableHttpResponse; 7 | import org.apache.http.client.methods.HttpGet; 8 | import org.apache.http.impl.client.CloseableHttpClient; 9 | import org.apache.http.impl.client.HttpClients; 10 | import org.apache.http.util.EntityUtils; 11 | import org.junit.Assert; 12 | import org.junit.Test; 13 | 14 | import java.io.IOException; 15 | import java.util.Calendar; 16 | 17 | /** 18 | * 调用聚合数据万年历API进行测试:https://www.juhe.cn/docs/api/id/177
19 | * 目前万年历API只支持 1901-1-1 到 2049-12-31(50年) 20 | * Created by heqiao on 2019/3/31. 21 | */ 22 | public class JuheTest { 23 | // 为了测试目的,申请的key,免费的API只允许调用100次每天,谁能给个不限次数的? 24 | private static final String API_KEY = "d8acde4f3be4a4e54c0d56c3a3b07109"; 25 | // 测试API 26 | private final String uriFormat = "http://v.juhe.cn/calendar/day?date=%s&key=%s"; 27 | 28 | private Gson gson = new Gson(); 29 | 30 | // 聚合api不靠谱,后面再找合适的吧 31 | private final Integer MAX_COUNT = 0; 32 | 33 | @Test 34 | public void testByJuhe() { 35 | // // 1901-1-1 36 | // Calendar start = Calendar.getInstance(); 37 | // start.set(Calendar.YEAR, 1901); 38 | // start.set(Calendar.MONTH, 0); 39 | // start.set(Calendar.DATE, 1); 40 | Calendar start = Calendar.getInstance(); 41 | // 2049-12-31 42 | Calendar end = Calendar.getInstance(); 43 | end.set(Calendar.YEAR, 2049); 44 | end.set(Calendar.MONTH, 11); 45 | end.set(Calendar.DATE, 31); 46 | 47 | int i = 0; 48 | Calendar t = start; 49 | while(t.before(end) && i < MAX_COUNT){ 50 | String tDate = getDate(t); 51 | String uri = String.format(uriFormat, tDate, API_KEY); 52 | HttpGet get = new HttpGet(uri); 53 | 54 | CloseableHttpClient client = null; 55 | CloseableHttpResponse response = null; 56 | try{ 57 | // 发送请求 58 | client = HttpClients.createDefault(); 59 | response = client.execute(get); 60 | String content = EntityUtils.toString(response.getEntity(), "UTF-8"); 61 | compare(t, content); 62 | } catch (Exception e){ 63 | e.printStackTrace(); 64 | } finally { 65 | try{ 66 | if(null != client){ 67 | client.close(); 68 | } 69 | if(null != response){ 70 | response.close(); 71 | } 72 | } catch (IOException iex) { 73 | //ignore 74 | } 75 | } 76 | t.add(Calendar.DATE, 1); 77 | } 78 | } 79 | 80 | /** 81 | * 聚合API的XX设计,居然不识别1901-01-01这种日期格式 82 | */ 83 | private String getDate(Calendar c){ 84 | return String.join("-", 85 | String.valueOf(c.get(Calendar.YEAR)), 86 | String.valueOf(c.get(Calendar.MONTH) + 1), 87 | String.valueOf(c.get(Calendar.DATE))); 88 | } 89 | 90 | private void compare(Calendar c, String juheContent){ 91 | JuheCalendarData data = gson.fromJson(juheContent, JuheCalendarData.class); 92 | Assert.assertEquals(Integer.valueOf(0), data.getError_code()); 93 | String date1 = getDate(c); 94 | String date2 = data.getResult().getData().getDate(); 95 | Assert.assertEquals(date1, date2); 96 | // 转LunarCalendar 97 | LunarCalendar lunar = new LunarCalendar(c); 98 | System.out.println(date1 + " -> " + lunar.getFullLunarName()); 99 | System.out.println("juheContent: " + juheContent); 100 | Assert.assertEquals(date1, date2); 101 | Assert.assertEquals(data.getResult().getData().getAnimalsYear(), String.valueOf(LunarData.getAnimalYearName(lunar.getLunarYear()))); 102 | Assert.assertEquals(data.getResult().getData().getLunarYear(), LunarData.getTraditionalYearName(lunar.getLunarYear())); 103 | Assert.assertEquals(data.getResult().getData().getLunar(), lunar.getLunar(false)); 104 | } 105 | 106 | /** 107 | * 聚合日历API返回的数据格式 108 | */ 109 | public static class JuheCalendarData{ 110 | public String reason; 111 | public Integer error_code; 112 | public Result result; 113 | 114 | public String getReason() { 115 | return reason; 116 | } 117 | 118 | public void setReason(String reason) { 119 | this.reason = reason; 120 | } 121 | 122 | public Integer getError_code() { 123 | return error_code; 124 | } 125 | 126 | public void setError_code(Integer error_code) { 127 | this.error_code = error_code; 128 | } 129 | 130 | public Result getResult() { 131 | return result; 132 | } 133 | 134 | public void setResult(Result result) { 135 | this.result = result; 136 | } 137 | } 138 | 139 | public static class Result{ 140 | public Data data; 141 | 142 | public Data getData() { 143 | return data; 144 | } 145 | 146 | public void setData(Data data) { 147 | this.data = data; 148 | } 149 | } 150 | 151 | public static class Data{ 152 | public String animalsYear; 153 | public String weekday; 154 | public String lunarYear; 155 | public String lunar; 156 | public String date; 157 | 158 | public String getAnimalsYear() { 159 | return animalsYear; 160 | } 161 | 162 | public void setAnimalsYear(String animalsYear) { 163 | this.animalsYear = animalsYear; 164 | } 165 | 166 | public String getWeekday() { 167 | return weekday; 168 | } 169 | 170 | public void setWeekday(String weekday) { 171 | this.weekday = weekday; 172 | } 173 | 174 | public String getLunarYear() { 175 | return lunarYear; 176 | } 177 | 178 | public void setLunarYear(String lunarYear) { 179 | this.lunarYear = lunarYear; 180 | } 181 | 182 | public String getLunar() { 183 | return lunar; 184 | } 185 | 186 | public void setLunar(String lunar) { 187 | this.lunar = lunar; 188 | } 189 | 190 | public String getDate() { 191 | return date; 192 | } 193 | 194 | public void setDate(String date) { 195 | this.date = date; 196 | } 197 | } 198 | } 199 | -------------------------------------------------------------------------------- /java/lunardemo/src/main/java/com/github/heqiao2010/lunar/demo/LunarValidate.java: -------------------------------------------------------------------------------- 1 | package com.github.heqiao2010.lunar.demo; 2 | 3 | import com.github.heqiao2010.lunar.LunarCalendar; 4 | import org.apache.http.client.methods.CloseableHttpResponse; 5 | import org.apache.http.client.methods.HttpGet; 6 | import org.apache.http.impl.client.CloseableHttpClient; 7 | import org.apache.http.impl.client.HttpClients; 8 | import org.apache.http.util.EntityUtils; 9 | 10 | import java.io.IOException; 11 | import java.util.Calendar; 12 | 13 | /** 14 | * 1901-2100年数据验证 15 | * 通过香港天文台提供的农历对照表数据进行验证:https://www.hko.gov.hk/tc/gts/time/conversion1_text.htm 16 | */ 17 | public class LunarValidate { 18 | public static void main(String args[]) { 19 | final int START = 1901; 20 | final int END = 2100; 21 | for (int year=START; year<=END; year++){ 22 | String uri = "http://www.hko.gov.hk/tc/gts/time/calendar/text/files/T" + year + "c.txt"; 23 | HttpGet get = new HttpGet(uri); 24 | CloseableHttpClient client = null; 25 | CloseableHttpResponse response = null; 26 | try { 27 | client = HttpClients.createDefault(); 28 | // 发送请求 29 | response = client.execute(get); 30 | String content = EntityUtils.toString(response.getEntity(), "Big5"); 31 | boolean pass = validateGanZhiAndAnimal(year, content) && validateLunarMonth(year, content); 32 | if (pass) { 33 | System.out.println(year + " passed!"); 34 | } else { 35 | System.out.println(year + " not passe!"); 36 | return; 37 | } 38 | } catch (Exception e){ 39 | e.printStackTrace(); 40 | } finally { 41 | try{ 42 | if(null != client){ 43 | client.close(); 44 | } 45 | if(null != response){ 46 | response.close(); 47 | } 48 | } catch (IOException iex) { 49 | //ignore 50 | } 51 | } 52 | } 53 | } 54 | 55 | /** 56 | * 校验农历月份 57 | */ 58 | private static boolean validateLunarMonth(int year, String content){ 59 | java.text.SimpleDateFormat df = new java.text.SimpleDateFormat("yyyy年MM月dd"); 60 | Calendar date = Calendar.getInstance(); 61 | date.set(Calendar.YEAR, year); 62 | date.set(Calendar.MONTH, 0); 63 | date.set(Calendar.DATE, 1); 64 | 65 | LunarCalendar lunar = LunarCalendar.solar2Lunar(date); 66 | String[] lines = content.split("\n"); 67 | 68 | int startLine = year == 2058 ? 0 : 3; 69 | for (int i=startLine; i " + fullLunarName + " passed!"); 83 | } else { 84 | System.out.println(df.format(lunar.getSolar().getTime()) + " not pass, line: " + lines[i] 85 | + " date: " + lunarDate2 + " month: " + lunarMoth1); 86 | return false; 87 | } 88 | } else { 89 | // 农历日期 90 | if (lunarDate1.equals(lunarDate2)) { 91 | System.out.println(df.format(lunar.getSolar().getTime()) + " ==> " + fullLunarName + " passed!"); 92 | } else { 93 | System.out.println(df.format(lunar.getSolar().getTime()) + " not pass, line: " + lines[i] 94 | + " date: " + lunarDate2); 95 | return false; 96 | } 97 | } 98 | lunar.add(Calendar.DATE, 1); 99 | } 100 | return true; 101 | } 102 | 103 | /** 104 | * 校验天干地支以及生肖 105 | */ 106 | private static boolean validateGanZhiAndAnimal(int year, String content) { 107 | // 由于公历年初可能还是农历的上一年,所以这里用6月1日来做转换,避免转化的农历还是上一年 108 | Calendar date = Calendar.getInstance(); 109 | date.set(Calendar.YEAR, year); 110 | date.set(Calendar.MONTH, 5); 111 | date.set(Calendar.DATE, 1); 112 | 113 | LunarCalendar lunar = LunarCalendar.solar2Lunar(date); 114 | String[] lines = content.split("\n"); 115 | 116 | String header = lines[0]; 117 | String lunarYear = header.substring(0, 4); 118 | String ganZhi = getGanZhi(year, header); 119 | String animalName = getAnimal(year, header); 120 | System.out.println(year + " -> " + lunarYear + " " + ganZhi + " " + animalName); 121 | 122 | if (lunarYear.equals(String.valueOf(lunar.getLyear())) 123 | && (ganZhi + "年").equals(LunarCalendar.getTraditionalYearName(lunar.getLyear())) 124 | && isAnimalEquals(animalName, String.valueOf(LunarCalendar.getAnimalYearName(lunar.getLyear())))) { 125 | return true; 126 | } 127 | System.out.println(lunar.getFullLunarName()); 128 | return false; 129 | } 130 | 131 | private static String getGanZhi(int year, String header){ 132 | // 2058年没有干支数据 133 | if (year == 2058){ 134 | return "戊寅"; 135 | } 136 | return header.substring(5, 7); 137 | } 138 | 139 | private static String getAnimal(int year, String header){ 140 | // 2058年没有生肖数据 141 | if (year == 2058){ 142 | return "虎"; 143 | } 144 | return year>=2011 ? header.substring(11, 12) : header.substring(9, 10); 145 | } 146 | 147 | private static String parseLunarDate(String line){ 148 | if (null == line || line.length() < 19){ 149 | System.out.println("unparsed line: " + line); 150 | return null; 151 | } 152 | return line.substring(15, 25).trim(); 153 | } 154 | 155 | private static boolean isMonthEquals(String month1, String month2) { 156 | if ("閏十一月".equals(month1) || "閏冬月".equals(month1)){ 157 | return "閏十一月".equals(month2) || "閏冬月".equals(month2); 158 | } 159 | if ("冬月".equals(month1) || "十一月".equals(month1)){ 160 | return "冬月".equals(month2) || "十一月".equals(month2); 161 | } 162 | if ("閏腊月".equals(month1) || "閏十二月".equals(month1)){ 163 | return "閏腊月".equals(month2) || "閏十二月".equals(month2); 164 | } 165 | if ("腊月".equals(month1) || "十二月".equals(month1)){ 166 | return "腊月".equals(month2) || "十二月".equals(month2); 167 | } 168 | return month1.equals(month2); 169 | } 170 | 171 | private static boolean isAnimalEquals(String animal1, String animal2) { 172 | // 香港天文台数据,2018之后生效由犬改为狗 173 | if ("狗".equals(animal1) || "犬".equals(animal1)){ 174 | return "狗".equals(animal2) || "犬".equals(animal2); 175 | } 176 | return animal1.equals(animal2); 177 | } 178 | } -------------------------------------------------------------------------------- /java/lunar/src/test/java/com/github/heqiao2010/lunar/test/HkOTest.java: -------------------------------------------------------------------------------- 1 | package com.github.heqiao2010.lunar.test; 2 | 3 | import com.github.heqiao2010.lunar.LunarCalendar; 4 | import com.github.heqiao2010.lunar.LunarData; 5 | import org.apache.http.client.methods.CloseableHttpResponse; 6 | import org.apache.http.client.methods.HttpGet; 7 | import org.apache.http.impl.client.CloseableHttpClient; 8 | import org.apache.http.impl.client.HttpClients; 9 | import org.apache.http.util.EntityUtils; 10 | import org.junit.Test; 11 | 12 | import java.io.IOException; 13 | import java.util.Calendar; 14 | 15 | /** 16 | * 1901-2100年数据验证 17 | * 通过香港天文台提供的农历对照表数据进行验证 18 | * see https://www.hko.gov.hk/tc/gts/time/conversion1_text.htm 19 | */ 20 | public class HkOTest { 21 | @Test 22 | public void validate() { 23 | final int START = 1901; 24 | final int END = 2100; 25 | for (int year=START; year<=END; year++){ 26 | String uri = "http://www.hko.gov.hk/tc/gts/time/calendar/text/files/T" + year + "c.txt"; 27 | HttpGet get = new HttpGet(uri); 28 | CloseableHttpClient client = null; 29 | CloseableHttpResponse response = null; 30 | try { 31 | client = HttpClients.createDefault(); 32 | // 发送请求 33 | response = client.execute(get); 34 | String content = EntityUtils.toString(response.getEntity(), "Big5"); 35 | boolean pass = validateGanZhiAndAnimal(year, content) && validateLunarMonth(year, content); 36 | if (pass) { 37 | System.out.println(year + " passed!"); 38 | } else { 39 | System.out.println(year + " not passe!"); 40 | return; 41 | } 42 | } catch (Exception e){ 43 | e.printStackTrace(); 44 | } finally { 45 | try{ 46 | if(null != client){ 47 | client.close(); 48 | } 49 | if(null != response){ 50 | response.close(); 51 | } 52 | } catch (IOException iex) { 53 | //ignore 54 | } 55 | } 56 | } 57 | } 58 | 59 | /** 60 | * 校验农历月份 61 | */ 62 | private boolean validateLunarMonth(int year, String content){ 63 | java.text.SimpleDateFormat df = new java.text.SimpleDateFormat("yyyy年MM月dd"); 64 | Calendar date = Calendar.getInstance(); 65 | date.set(Calendar.YEAR, year); 66 | date.set(Calendar.MONTH, 0); 67 | date.set(Calendar.DATE, 1); 68 | 69 | LunarCalendar lunar = LunarCalendar.solar2Lunar(date); 70 | String[] lines = content.split("\n"); 71 | 72 | int startLine = year == 2058 ? 0 : 3; 73 | for (int i=startLine; i " + fullLunarName + " passed!"); 87 | } else { 88 | System.out.println(df.format(lunar.getTime()) + " not pass, line: " + lines[i] 89 | + " date: " + lunarDate2 + " month: " + lunarMoth1); 90 | return false; 91 | } 92 | } else { 93 | // 农历日期 94 | if (lunarDate1.equals(lunarDate2)) { 95 | System.out.println(df.format(lunar.getTime()) + " ==> " + fullLunarName + " passed!"); 96 | } else { 97 | System.out.println(df.format(lunar.getTime()) + " not pass, line: " + lines[i] 98 | + " date: " + lunarDate2); 99 | return false; 100 | } 101 | } 102 | lunar.add(Calendar.DATE, 1); 103 | } 104 | return true; 105 | } 106 | 107 | /** 108 | * 校验天干地支以及生肖 109 | */ 110 | private boolean validateGanZhiAndAnimal(int year, String content) { 111 | // 由于公历年初可能还是农历的上一年,所以这里用6月1日来做转换,避免转化的农历还是上一年 112 | Calendar date = Calendar.getInstance(); 113 | date.set(Calendar.YEAR, year); 114 | date.set(Calendar.MONTH, 5); 115 | date.set(Calendar.DATE, 1); 116 | 117 | LunarCalendar lunar = LunarCalendar.solar2Lunar(date); 118 | String[] lines = content.split("\n"); 119 | 120 | String header = lines[0]; 121 | String lunarYear = header.substring(0, 4); 122 | String ganZhi = getGanZhi(year, header); 123 | String animalName = getAnimal(year, header); 124 | System.out.println(year + " -> " + lunarYear + " " + ganZhi + " " + animalName); 125 | 126 | if (lunarYear.equals(String.valueOf(lunar.getLunarYear())) 127 | && (ganZhi + "年").equals(LunarData.getTraditionalYearName(lunar.getLunarYear())) 128 | && isAnimalEquals(animalName, String.valueOf(LunarData.getAnimalYearName(lunar.getLunarYear())))) { 129 | return true; 130 | } 131 | System.out.println(lunar.getFullLunarName()); 132 | return false; 133 | } 134 | 135 | private static String getGanZhi(int year, String header){ 136 | // 2058年没有干支数据 137 | if (year == 2058){ 138 | return "戊寅"; 139 | } 140 | return header.substring(5, 7); 141 | } 142 | 143 | private static String getAnimal(int year, String header){ 144 | // 2058年没有生肖数据 145 | if (year == 2058){ 146 | return "虎"; 147 | } 148 | return year>=2011 ? header.substring(11, 12) : header.substring(9, 10); 149 | } 150 | 151 | private static String parseLunarDate(String line){ 152 | if (null == line || line.length() < 19){ 153 | System.out.println("unparsed line: " + line); 154 | return null; 155 | } 156 | return line.substring(15, 25).trim(); 157 | } 158 | 159 | private static boolean isMonthEquals(String month1, String month2) { 160 | if ("閏十一月".equals(month1) || "閏冬月".equals(month1)){ 161 | return "閏十一月".equals(month2) || "閏冬月".equals(month2); 162 | } 163 | if ("冬月".equals(month1) || "十一月".equals(month1)){ 164 | return "冬月".equals(month2) || "十一月".equals(month2); 165 | } 166 | if ("閏腊月".equals(month1) || "閏十二月".equals(month1)){ 167 | return "閏腊月".equals(month2) || "閏十二月".equals(month2); 168 | } 169 | if ("腊月".equals(month1) || "十二月".equals(month1)){ 170 | return "腊月".equals(month2) || "十二月".equals(month2); 171 | } 172 | return month1.equals(month2); 173 | } 174 | 175 | private static boolean isAnimalEquals(String animal1, String animal2) { 176 | // 香港天文台数据,2018之后生效由犬改为狗 177 | if ("狗".equals(animal1) || "犬".equals(animal1)){ 178 | return "狗".equals(animal2) || "犬".equals(animal2); 179 | } 180 | return animal1.equals(animal2); 181 | } 182 | } 183 | -------------------------------------------------------------------------------- /java/lunar/src/test/java/com/github/heqiao2010/lunar/test/DateInfoCollector.java: -------------------------------------------------------------------------------- 1 | package com.github.heqiao2010.lunar.test; 2 | 3 | import org.apache.http.client.methods.CloseableHttpResponse; 4 | import org.apache.http.client.methods.HttpGet; 5 | import org.apache.http.impl.client.CloseableHttpClient; 6 | import org.apache.http.impl.client.HttpClients; 7 | import org.apache.http.util.EntityUtils; 8 | import org.junit.Test; 9 | 10 | import java.io.IOException; 11 | import java.util.*; 12 | 13 | /** 14 | * 通过香港天文台提供的农历对照表数据生成1901-2100年的数据 15 | * see https://www.hko.gov.hk/tc/gts/time/conversion1_text.htm 16 | */ 17 | public class DateInfoCollector { 18 | private static final Map MONTH_NUMBER_CONVERT_MAP = new HashMap(); 19 | 20 | static { 21 | MONTH_NUMBER_CONVERT_MAP.put("一月", 1); 22 | MONTH_NUMBER_CONVERT_MAP.put("二月", 2); 23 | MONTH_NUMBER_CONVERT_MAP.put("三月", 3); 24 | MONTH_NUMBER_CONVERT_MAP.put("四月", 4); 25 | MONTH_NUMBER_CONVERT_MAP.put("五月", 5); 26 | MONTH_NUMBER_CONVERT_MAP.put("六月", 6); 27 | MONTH_NUMBER_CONVERT_MAP.put("七月", 7); 28 | MONTH_NUMBER_CONVERT_MAP.put("八月", 8); 29 | MONTH_NUMBER_CONVERT_MAP.put("九月", 9); 30 | MONTH_NUMBER_CONVERT_MAP.put("十月", 10); 31 | MONTH_NUMBER_CONVERT_MAP.put("十一月", 11); 32 | MONTH_NUMBER_CONVERT_MAP.put("十二月", 12); 33 | } 34 | 35 | @Test 36 | public void collector() { 37 | final int startYear = 1901; 38 | final int endYear = 2100; 39 | 40 | Map lunarLeapMonthMap = new LinkedHashMap(); 41 | List> parsedDateList = new ArrayList>(); 42 | 43 | for (int year = startYear; year <= endYear; year++){ 44 | String uri = "http://www.hko.gov.hk/tc/gts/time/calendar/text/files/T" + year + "c.txt"; 45 | HttpGet get = new HttpGet(uri); 46 | CloseableHttpClient client = null; 47 | CloseableHttpResponse response = null; 48 | try { 49 | client = HttpClients.createDefault(); 50 | // 发送请求 51 | response = client.execute(get); 52 | String content = EntityUtils.toString(response.getEntity(), "Big5"); 53 | doCollect(parsedDateList, lunarLeapMonthMap, content, year); 54 | } catch (Exception e){ 55 | e.printStackTrace(); 56 | } finally { 57 | try{ 58 | if(null != client){ 59 | client.close(); 60 | } 61 | if(null != response){ 62 | response.close(); 63 | } 64 | } catch (IOException iex) { 65 | //ignore 66 | } 67 | } 68 | } 69 | 70 | System.out.println("lunar month map:"); 71 | for (Pair pair : parsedDateList) { 72 | System.out.println(pair.getKey() + "->" + pair.getValue()); 73 | } 74 | 75 | System.out.println("leap month info:"); 76 | for (Map.Entry entry : lunarLeapMonthMap.entrySet()) { 77 | System.out.println(entry.getKey() + "->" + entry.getValue()); 78 | } 79 | 80 | System.out.println("lunar codes:"); 81 | for (Pair pair : parsedDateList){ 82 | if (pair.getKey().endsWith("十二月")) { 83 | if (pair.getValue().startsWith("01")){ 84 | System.out.print("13" + pair.getValue().substring(2)); 85 | System.out.print("},"); 86 | } else { 87 | System.out.print(removeStart0(pair.getValue())); 88 | System.out.print("},"); 89 | } 90 | System.out.println(); 91 | } else { 92 | System.out.print(removeStart0(pair.getValue())); 93 | System.out.print(","); 94 | } 95 | } 96 | System.out.println(); 97 | } 98 | 99 | private void doCollect(List> parsedDateList, Map lunarLeapMonthMap, 100 | String content, int year) { 101 | Map dateMap = new LinkedHashMap(); 102 | String[] lines = content.split("\n"); 103 | 104 | for (int i=3; i entry : dateMap.entrySet()) { 133 | if (entry.getValue().endsWith("月")) { 134 | String lunarCode = entry.getKey().substring(5, 7) + entry.getKey().substring(8, 10); 135 | Pair pair = new Pair(year + entry.getValue(), lunarCode); 136 | parsedDateList.add(pair); 137 | } 138 | } 139 | } 140 | 141 | private static String parseLunarDate(String line){ 142 | if (null == line || line.length() < 19){ 143 | System.out.println("unparsed line: " + line); 144 | return null; 145 | } 146 | return line.substring(15, 25).trim(); 147 | } 148 | 149 | private static String parseSolarDate(String line){ 150 | if (line.length() < 14) { 151 | System.out.println("unparsed line: " + line); 152 | return null; 153 | } 154 | String solarDate = line.substring(0, 14).trim(); 155 | if (solarDate.length() < 9 || solarDate.length() > 11 || solarDate.charAt(solarDate.length()-1) != '日') { 156 | System.out.println("unparsed line: " + line); 157 | return null; 158 | } 159 | if (solarDate.length() < 11) { 160 | String year = solarDate.substring(0, 4); 161 | String month; 162 | String day; 163 | if (isNumber(solarDate.charAt(6))) { 164 | month = solarDate.substring(5, 7); 165 | } else { 166 | month = "0" + solarDate.substring(5, 6); 167 | } 168 | if (isNumber(solarDate.charAt(solarDate.length() -3))) { 169 | day = solarDate.substring(solarDate.length() - 3, solarDate.length() - 1); 170 | } else { 171 | day = "0" + solarDate.substring(solarDate.length() - 2, solarDate.length() - 1); 172 | } 173 | return year + "年" + month + "月" + day + "日"; 174 | } 175 | return solarDate; 176 | } 177 | 178 | private static boolean isNumber(char c){ 179 | return c >= '0' && c <= '9'; 180 | } 181 | 182 | private static String removeStart0(String code){ 183 | return code == null || code.charAt(0) != '0' ? code : code.substring(1); 184 | } 185 | 186 | private static class Pair { 187 | private K key; 188 | private V value; 189 | Pair(K key, V value){ 190 | this.key = key; 191 | this.value = value; 192 | } 193 | K getKey(){ 194 | return key; 195 | } 196 | V getValue(){ 197 | return value; 198 | } 199 | } 200 | } 201 | -------------------------------------------------------------------------------- /java/lunar/src/test/java/com/github/heqiao2010/lunar/TestLunarSolar.java: -------------------------------------------------------------------------------- 1 | package com.github.heqiao2010.lunar; 2 | 3 | import com.github.heqiao2010.lunar.LunarCalendar; 4 | import org.apache.commons.lang3.StringUtils; 5 | import org.junit.Assert; 6 | import org.junit.Before; 7 | import org.junit.Test; 8 | 9 | import java.io.*; 10 | import java.util.*; 11 | import java.util.HashMap; 12 | import java.util.Map; 13 | 14 | public class TestLunarSolar { 15 | private static List testCaseList; 16 | private static Map monthMap; 17 | private static Map dayMap; 18 | 19 | @Before 20 | public void setUp() throws IOException { 21 | monthMap = new HashMap(); 22 | monthMap.put("正月", 1); 23 | monthMap.put("二月", 2); 24 | monthMap.put("三月", 3); 25 | monthMap.put("四月", 4); 26 | monthMap.put("五月", 5); 27 | monthMap.put("六月", 6); 28 | monthMap.put("七月", 7); 29 | monthMap.put("八月", 8); 30 | monthMap.put("九月", 9); 31 | monthMap.put("十月", 10); 32 | monthMap.put("十一月", 11); 33 | monthMap.put("十二月", 12); 34 | monthMap.put("閏正月", 1); 35 | monthMap.put("閏二月", 2); 36 | monthMap.put("閏三月", 3); 37 | monthMap.put("閏四月", 4); 38 | monthMap.put("閏五月", 5); 39 | monthMap.put("閏六月", 6); 40 | monthMap.put("閏七月", 7); 41 | monthMap.put("閏八月", 8); 42 | monthMap.put("閏九月", 9); 43 | monthMap.put("閏十月", 10); 44 | monthMap.put("閏十一月", 11); 45 | monthMap.put("閏十二月", 12); 46 | 47 | dayMap = new HashMap(); 48 | dayMap.put("正月", 1); 49 | dayMap.put("二月", 1); 50 | dayMap.put("三月", 1); 51 | dayMap.put("四月", 1); 52 | dayMap.put("五月", 1); 53 | dayMap.put("六月", 1); 54 | dayMap.put("七月", 1); 55 | dayMap.put("八月", 1); 56 | dayMap.put("九月", 1); 57 | dayMap.put("十月", 1); 58 | dayMap.put("十一月", 1); 59 | dayMap.put("十二月", 1); 60 | dayMap.put("閏正月", 1); 61 | dayMap.put("閏二月", 1); 62 | dayMap.put("閏三月", 1); 63 | dayMap.put("閏四月", 1); 64 | dayMap.put("閏五月", 1); 65 | dayMap.put("閏六月", 1); 66 | dayMap.put("閏七月", 1); 67 | dayMap.put("閏八月", 1); 68 | dayMap.put("閏九月", 1); 69 | dayMap.put("閏十月", 1); 70 | dayMap.put("閏十一月", 1); 71 | dayMap.put("閏十二月", 1); 72 | dayMap.put("初二", 2); 73 | dayMap.put("初三", 3); 74 | dayMap.put("初四", 4); 75 | dayMap.put("初五", 5); 76 | dayMap.put("初六", 6); 77 | dayMap.put("初七", 7); 78 | dayMap.put("初八", 8); 79 | dayMap.put("初九", 9); 80 | dayMap.put("初十", 10); 81 | dayMap.put("十一", 11); 82 | dayMap.put("十二", 12); 83 | dayMap.put("十三", 13); 84 | dayMap.put("十四", 14); 85 | dayMap.put("十五", 15); 86 | dayMap.put("十六", 16); 87 | dayMap.put("十七", 17); 88 | dayMap.put("十八", 18); 89 | dayMap.put("十九", 19); 90 | dayMap.put("二十", 20); 91 | dayMap.put("廿一", 21); 92 | dayMap.put("廿二", 22); 93 | dayMap.put("廿三", 23); 94 | dayMap.put("廿四", 24); 95 | dayMap.put("廿五", 25); 96 | dayMap.put("廿六", 26); 97 | dayMap.put("廿七", 27); 98 | dayMap.put("廿八", 28); 99 | dayMap.put("廿九", 29); 100 | dayMap.put("三十", 30); 101 | 102 | testCaseList = new ArrayList(); 103 | loadTestCase(); 104 | } 105 | 106 | /** 107 | * 农历日期信息 108 | */ 109 | public class LunarDateInfo { 110 | private int year; // 农历年份 111 | private int month; // 农历月份 112 | private int day; // 农历day-of-month 113 | private int leap; // 是否闰月 114 | 115 | public LunarDateInfo(int year, int month, int day, int leap) { 116 | this.year = year; 117 | this.month = month; 118 | this.day = day; 119 | this.leap = leap; 120 | } 121 | 122 | @Override 123 | public String toString() { 124 | return year + "-" + month + "-" + day + "\t" + leap; 125 | } 126 | } 127 | 128 | /** 129 | * 校验阳历转农历 130 | * @param solar 阳历日期 131 | * @param lunar 农历日期 132 | * @param isLeapMonth 当前农历是否是闰月 133 | * @return true-符合预期/false-不符合预期 134 | */ 135 | private boolean validSolar2Lunar(String solar, String lunar, String isLeapMonth) { 136 | String[] solaritems = solar.trim().split("-"); 137 | String[] lunaritems = lunar.trim().split("-"); 138 | 139 | int syear = Integer.valueOf(solaritems[0]); 140 | int smonth = Integer.valueOf(solaritems[1]); 141 | int sday = Integer.valueOf(solaritems[2]); 142 | 143 | int lyear = Integer.valueOf(lunaritems[0]); 144 | int lmonth = Integer.valueOf(lunaritems[1]); 145 | int lday = Integer.valueOf(lunaritems[2]); 146 | 147 | boolean leap = StringUtils.equalsIgnoreCase(isLeapMonth, "1") ? true: false; 148 | 149 | Calendar calendar = Calendar.getInstance(); 150 | calendar.set(Calendar.YEAR, syear); 151 | calendar.set(Calendar.MONTH, smonth - 1); 152 | calendar.set(Calendar.DATE, sday); 153 | 154 | LunarCalendar lunarDate = LunarCalendar.solar2Lunar(calendar); 155 | int year = lunarDate.getLunarYear(); 156 | int month = lunarDate.getLunarMonth(); 157 | int day = lunarDate.getDayOfLunarMonth(); 158 | boolean leapMonth = lunarDate.isLeapMonth(); 159 | 160 | return year == lyear && month == lmonth && day == lday && leap == leapMonth; 161 | } 162 | 163 | /** 164 | * 校验农历转阳历 165 | * @param solar 阳历日期 166 | * @param lunar 农历日期 167 | * @param isLeapMonth 当前农历是否是闰月 168 | * @return true-符合预期/false-不符合预期 169 | */ 170 | private boolean validLunar2Solar(String solar, String lunar, String isLeapMonth) { 171 | String[] solaritems = solar.trim().split("-"); 172 | String[] lunaritems = lunar.trim().split("-"); 173 | 174 | 175 | int syear = Integer.valueOf(solaritems[0]); 176 | int smonth = Integer.valueOf(solaritems[1]); 177 | int sday = Integer.valueOf(solaritems[2]); 178 | 179 | int lyear = Integer.valueOf(lunaritems[0]); 180 | int lmonth = Integer.valueOf(lunaritems[1]); 181 | int lday = Integer.valueOf(lunaritems[2]); 182 | 183 | boolean leap = StringUtils.equalsIgnoreCase(isLeapMonth, "1") ? true: false; 184 | 185 | Calendar calendar = LunarCalendar.lunar2Solar(lyear, lmonth, lday, leap); 186 | int year = calendar.get(Calendar.YEAR); 187 | int month = calendar.get(Calendar.MONTH) + 1; 188 | int day = calendar.get(Calendar.DAY_OF_MONTH); 189 | 190 | return year == syear && month == smonth && day == sday; 191 | } 192 | 193 | /** 194 | * 加载香港天文台每年的农历阳历对照表 195 | * @param fileName 文件路径 196 | * @param dateInfo 上一个文件农历最后一天 197 | * @return 当前文件最后一天的农历信息 198 | * @throws IOException 199 | */ 200 | private LunarDateInfo loadPerFile(String fileName, LunarDateInfo dateInfo) throws IOException { 201 | InputStream is = this.getClass().getResourceAsStream(fileName); 202 | BufferedReader reader = new BufferedReader(new InputStreamReader(is, "big5")); 203 | 204 | boolean skip = true; 205 | String line; 206 | while ((line = reader.readLine()) != null) { 207 | line = line.trim(); 208 | 209 | if (StringUtils.isBlank(line)) continue; // 过滤空行 210 | if (line.startsWith("公曆日期")) skip = false; // 开始加载标识 211 | if (skip) continue; // 去除首行 212 | if (!(line.startsWith("1") || line.startsWith("2"))) continue; // 过滤非数据行 213 | 214 | String[] items = line.split(" "); 215 | List itemList = new ArrayList(); 216 | for (String item : items) { 217 | item = item.trim(); 218 | if (StringUtils.isNotBlank(item)) { 219 | itemList.add(item); 220 | } 221 | } 222 | 223 | dateInfo = parseMonthDay(dateInfo.year, dateInfo.month, itemList.get(1), dateInfo.leap); 224 | 225 | String solar = itemList.get(0).replaceAll("年|月", "-").replace("日", ""); 226 | testCaseList.add(solar + "\t" + dateInfo.toString()); 227 | } 228 | 229 | return dateInfo; 230 | } 231 | 232 | /** 233 | * 解析农历日期信息 234 | * @param year 年份 235 | * @param month 月份 236 | * @param day day-of-month 237 | * @param leap 是否闰月 238 | * @return LunarDateInfo 239 | */ 240 | private LunarDateInfo parseMonthDay(int year, int month, String day, int leap) { 241 | int currDay = dayMap.get(day); 242 | int currYear = year; 243 | int currMonth = month; 244 | 245 | if (currDay == 1) { 246 | currMonth = monthMap.get(day); 247 | leap = day.startsWith("閏") ? 1 : 0; 248 | } 249 | 250 | if (currMonth == 1 && currDay == 1) currYear += 1; 251 | 252 | return new LunarDateInfo(currYear, currMonth, currDay, leap); 253 | } 254 | 255 | /** 256 | * 构造测试用例 257 | * @throws IOException 258 | */ 259 | private void buildTestCase() throws IOException { 260 | LunarDateInfo dateInfo = new LunarDateInfo(1900, 11, 0, 0); 261 | 262 | for (int index = 1901; index < 2101; ++ index) { 263 | dateInfo = loadPerFile("/T" + index + "c.txt", dateInfo); 264 | } 265 | } 266 | 267 | /** 268 | * 加载处理好的测试用例 269 | * @throws IOException 270 | */ 271 | private void loadTestCase() throws IOException { 272 | InputStream is = this.getClass().getResourceAsStream("/solar_lunar_test.txt"); 273 | BufferedReader reader = new BufferedReader(new InputStreamReader(is)); 274 | 275 | String line; 276 | while ((line = reader.readLine()) != null) { 277 | line = line.trim(); 278 | testCaseList.add(line); 279 | } 280 | reader.close(); 281 | } 282 | 283 | @Test 284 | public void testSolar2Lunar() { 285 | for (String testCase : testCaseList) { 286 | String[] testItems = testCase.split("\t"); 287 | String solar = testItems[0]; 288 | String lunar = testItems[1]; 289 | String leap = testItems[2]; 290 | 291 | Assert.assertTrue(validSolar2Lunar(solar, lunar, leap)); 292 | } 293 | } 294 | 295 | @Test 296 | public void testLunar2Solar() { 297 | for (String testCase : testCaseList) { 298 | String[] testItems = testCase.split("\t"); 299 | String solar = testItems[0]; 300 | String lunar = testItems[1]; 301 | String leap = testItems[2]; 302 | 303 | Assert.assertTrue(validLunar2Solar(solar, lunar, leap)); 304 | } 305 | } 306 | 307 | @Test 308 | public void testCaseCount() { 309 | Assert.assertEquals(73049, testCaseList.size()); 310 | } 311 | } 312 | -------------------------------------------------------------------------------- /java/lunar/src/main/java/com/github/heqiao2010/lunar/LunarCalendar.java: -------------------------------------------------------------------------------- 1 | package com.github.heqiao2010.lunar; 2 | 3 | import java.util.*; 4 | 5 | /** 6 | * 中国农历 7 | * Created by joel on 2019/3/31. 8 | * 9 | * @author joel 10 | */ 11 | public class LunarCalendar extends GregorianCalendar { 12 | 13 | /** 14 | * serialVersionUID 15 | */ 16 | private static final long serialVersionUID = 7241031233810655166L; 17 | 18 | // ------------------------ 农历相关成员变量 -------------------------------- 19 | 20 | // 农历年,和公历可能不一样 21 | private int lunarYear; 22 | // 农历月(范围1-12和公历不一样) 23 | private int lunarMonth; 24 | // 农历日期 25 | private int dayOfLunarMonth; 26 | // 是否为闰月日期 27 | private boolean isLeapMonth = false; 28 | // 农历这年闰月,如果不闰月,默认为0 29 | private int leapMonth = 0; 30 | 31 | // ------------------------ 构造方法 -------------------------------- 32 | 33 | public LunarCalendar() { 34 | super(); 35 | computeBySolarDate(get(Calendar.YEAR), get(Calendar.MONTH), get(Calendar.DATE)); 36 | } 37 | 38 | public LunarCalendar(TimeZone zone) { 39 | super(zone); 40 | computeBySolarDate(get(Calendar.YEAR), get(Calendar.MONTH), get(Calendar.DATE)); 41 | } 42 | 43 | public LunarCalendar(Locale aLocale) { 44 | super(aLocale); 45 | computeBySolarDate(get(Calendar.YEAR), get(Calendar.MONTH), get(Calendar.DATE)); 46 | } 47 | 48 | public LunarCalendar(TimeZone zone, Locale aLocale) { 49 | super(zone, aLocale); 50 | computeBySolarDate(get(Calendar.YEAR), get(Calendar.MONTH), get(Calendar.DATE)); 51 | } 52 | 53 | /** 54 | * 通过公历年、月、日构造 55 | * @param year 公历年 56 | * @param month 公历月 57 | * @param dayOfMonth 公历日 58 | */ 59 | public LunarCalendar(int year, int month, int dayOfMonth) { 60 | super(year, month, dayOfMonth); 61 | computeBySolarDate(get(Calendar.YEAR), get(Calendar.MONTH), get(Calendar.DATE)); 62 | } 63 | 64 | public LunarCalendar(int year, int month, int dayOfMonth, int hourOfDay, int minute) { 65 | super(year, month, dayOfMonth, hourOfDay, minute); 66 | computeBySolarDate(get(Calendar.YEAR), get(Calendar.MONTH), get(Calendar.DATE)); 67 | } 68 | 69 | public LunarCalendar(int year, int month, int dayOfMonth, int hourOfDay, int minute, int second) { 70 | super(year, month, dayOfMonth, hourOfDay, minute, second); 71 | computeBySolarDate(get(Calendar.YEAR), get(Calendar.MONTH), get(Calendar.DATE)); 72 | } 73 | 74 | /** 75 | * 通过农历年、月、日构造 76 | * 77 | * @param lunarYear 农历年 78 | * @param lunarMonth 农历月份,范围1-12 79 | * @param dayOfLunarMonth 农历日 80 | * @param isLeapMonth 是否闰月 81 | */ 82 | public LunarCalendar(int lunarYear, int lunarMonth, int dayOfLunarMonth, boolean isLeapMonth) { 83 | computeByLunarDate(lunarYear, lunarMonth, dayOfLunarMonth, isLeapMonth); 84 | } 85 | 86 | /** 87 | * 通过公历构造 88 | * 89 | * @param calendar  公历日期 90 | */ 91 | public LunarCalendar(Calendar calendar) { 92 | super(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), 93 | calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), calendar.get(Calendar.SECOND)); 94 | computeBySolarDate(get(Calendar.YEAR), get(Calendar.MONTH), get(Calendar.DATE)); 95 | } 96 | 97 | // ------------------------ 静态方法 -------------------------------- 98 | 99 | /** 100 | * 公历转农历 101 | * 102 | * @param solar  公历日期 103 | * @return 农历日期 104 | */ 105 | public static LunarCalendar solar2Lunar(Calendar solar) { 106 | return new LunarCalendar(solar); 107 | } 108 | 109 | /** 110 | * 农历转公历 111 | * 112 | * @param lunarYear  农历年 113 | * @param lunarMonth  农历月,从1开始 114 | * @param LunarDate  农历日 115 | * @param isLeapMonth  是否润月 116 | * @return 公历日期 117 | */ 118 | public static Calendar lunar2Solar(int lunarYear, int lunarMonth, int LunarDate, boolean isLeapMonth) { 119 | LunarCalendar ret = new LunarCalendar(); 120 | ret.computeByLunarDate(lunarYear, lunarMonth, LunarDate, isLeapMonth); 121 | return ret; 122 | } 123 | 124 | // ------------------------ 成员方法 -------------------------------- 125 | 126 | /** 127 | * 公历上的操作,加减均是公历上的“一年”,“一个月” 128 | * @param field {@link java.util.Calendar} YEAR/MONTH/DATE 129 | * @param amount 数量,可正可负 130 | */ 131 | @Override 132 | public void add(int field, int amount) { 133 | super.add(field, amount); 134 | computeBySolarDate(get(Calendar.YEAR), get(Calendar.MONTH), get(Calendar.DATE)); 135 | } 136 | 137 | /** 138 | * 农历上的年月日,加减均是农历上的“一年”,“一个月” 139 | * @param field {@link java.util.Calendar} YEAR/MONTH/DATE 140 | * @param amount 数量,可正可负 141 | */ 142 | public void addByLunar(int field, int amount) { 143 | switch (field) { 144 | case Calendar.DATE: 145 | super.add(Calendar.DATE, amount); 146 | computeBySolarDate(get(Calendar.YEAR), get(Calendar.MONTH), get(Calendar.DATE)); 147 | break; 148 | case Calendar.MONTH: 149 | addLunarMonths(amount); 150 | break; 151 | case Calendar.YEAR: 152 | // 增加一个农历年,保持月/日不变,清空闰月状态 153 | checkComputeLunarDate(lunarYear + amount, lunarMonth, dayOfLunarMonth, false); 154 | break; 155 | default: 156 | throw new IllegalArgumentException(String.format("unsupported field: %d", field)); 157 | } 158 | } 159 | 160 | /** 161 | * 计算月份加减 162 | * 163 | * @param amount 数量 164 | */ 165 | public void addLunarMonths(int amount) { 166 | int y = lunarYear; 167 | int m = -1; 168 | int index = LunarCodes.monthIndex(y, lunarMonth, isLeapMonth); 169 | boolean isLeapMonth = false; 170 | int sum = index + amount; 171 | if (amount > 0) { 172 | for (int _y = lunarYear; _y < LunarData.MAX_YEAR; _y++) { 173 | final short[] a = LunarCodes.monthCodes(_y); 174 | int lunarMonths = a.length - 1; 175 | sum -= lunarMonths; 176 | if (sum > 0) { 177 | y++; 178 | } 179 | if (sum <= 0) { 180 | if (sum == 0) m = lunarMonths; 181 | else m = lunarMonths + sum; 182 | isLeapMonth = a[0] > 0 && a[0] + 1 == m; 183 | if (isLeapMonth || a[0] > 0 && a[0] < m) { 184 | m--; 185 | } 186 | break; 187 | } 188 | } 189 | if (sum > 0) { 190 | throw new IllegalArgumentException(String.format("add of month out of range: %d", amount)); 191 | } 192 | } else if (amount < 0) { 193 | if (sum > 0) { 194 | m = sum; 195 | } else if (sum == 0) { 196 | Map.Entry en = LunarCodes.month(--y, -1); 197 | m = en.getKey(); 198 | isLeapMonth = en.getValue(); 199 | } else { 200 | for (int i = lunarYear - 1; i > LunarData.MINI_YEAR; i--) { 201 | int lunarMonths = LunarCodes.monthCodes(i).length - 1; 202 | sum += lunarMonths; 203 | y--; 204 | if (sum >= 0) { 205 | Map.Entry en; 206 | if (sum == 0) { 207 | en = LunarCodes.month(--y, -1); 208 | } else { 209 | en = LunarCodes.month(y, sum + 1); 210 | } 211 | m = en.getKey(); 212 | isLeapMonth = en.getValue(); 213 | break; 214 | } 215 | } 216 | } 217 | if (sum < 0) { 218 | throw new IllegalArgumentException(String.format("add of month out of range: %d", amount)); 219 | } 220 | } 221 | checkComputeLunarDate(y, m, dayOfLunarMonth, isLeapMonth); 222 | } 223 | 224 | /** 225 | * 校验 day of month 是否是合法的,如果越限则从30号减到29号 226 | * 227 | * @param y lunar year 228 | * @param m lunar month 229 | * @param d lunar day of month 230 | * @param isLeap 闰月 231 | */ 232 | private void checkComputeLunarDate(int y, int m, int d, boolean isLeap) { 233 | int days = d; 234 | if (d > 29 && d > LunarUtils.lengthOfMonth(y, m, isLeap)) { 235 | days--; 236 | } 237 | computeByLunarDate(y, m, days, isLeap); 238 | } 239 | 240 | @Override 241 | public void set(int field, int value) { 242 | super.set(field, value); 243 | computeBySolarDate(get(Calendar.YEAR), get(Calendar.MONTH), get(Calendar.DATE)); 244 | } 245 | 246 | @Override 247 | public void roll(int field, int amount) { 248 | super.roll(field, amount); 249 | computeBySolarDate(get(Calendar.YEAR), get(Calendar.MONTH), get(Calendar.DATE)); 250 | } 251 | 252 | @Override 253 | public String toString() { 254 | if (this.lunarYear < LunarData.MINI_YEAR || this.lunarYear > LunarData.MAX_YEAR || this.lunarMonth < 1 255 | || this.lunarMonth > 12 || this.dayOfLunarMonth < 1 256 | || this.dayOfLunarMonth > 30) { 257 | return String.format("Wrong lunar date: %d %d %d", lunarYear, lunarMonth, dayOfLunarMonth); 258 | } 259 | return String.format("%s年%s%s月%s", LunarData.getYearName(this.lunarYear), this.isLeapMonth() ? "闰" : "", 260 | LunarData.getMonthName(this.lunarMonth), LunarData.getDayName(this.dayOfLunarMonth)); 261 | } 262 | 263 | @Override 264 | public boolean equals(Object o) { 265 | if (this == o) return true; 266 | if (!(o instanceof LunarCalendar)) return false; 267 | if (!super.equals(o)) return false; 268 | LunarCalendar that = (LunarCalendar) o; 269 | return lunarYear == that.lunarYear && 270 | lunarMonth == that.lunarMonth && 271 | dayOfLunarMonth == that.dayOfLunarMonth && 272 | isLeapMonth == that.isLeapMonth && 273 | leapMonth == that.leapMonth; 274 | } 275 | 276 | @Override 277 | public int hashCode() { 278 | int result = super.hashCode(); 279 | result = 31 * result + lunarYear; 280 | result = 31 * result + lunarMonth; 281 | result = 31 * result + dayOfLunarMonth; 282 | result = 31 * result + leapMonth; 283 | result = 31 * result + (isLeapMonth ? 1 : 0); 284 | return result; 285 | } 286 | 287 | @Override 288 | public Object clone() { 289 | LunarCalendar other = (LunarCalendar) super.clone(); 290 | other.lunarYear = getLunarYear(); 291 | other.lunarMonth = getLunarMonth(); 292 | other.dayOfLunarMonth = getDayOfLunarMonth(); 293 | other.leapMonth = getLeapMonth(); 294 | other.isLeapMonth = isLeapMonth(); 295 | return other; 296 | } 297 | 298 | /** 299 | * 返回农历日期,不包含年份 300 | * 301 | * @param showLeap  是否显示闰月的闰字 302 | * @return 农历日期 303 | */ 304 | public String getLunar(boolean showLeap) { 305 | if (this.lunarMonth < 1 || this.lunarMonth > 12 || this.dayOfLunarMonth < 1 306 | || this.dayOfLunarMonth > 30) { 307 | throw new IllegalArgumentException(String.format("Wrong lunar dayOfLunarMonth: %d %d", lunarMonth, dayOfLunarMonth)); 308 | } 309 | if (showLeap) { 310 | return String.format("%s%s月%s", this.isLeapMonth() ? "闰" : "", LunarData.getMonthName(this.lunarMonth), 311 | LunarData.getDayName(this.dayOfLunarMonth)); 312 | } else { 313 | return String.format("%s月%s", LunarData.getMonthName(this.lunarMonth), 314 | LunarData.getDayName(this.dayOfLunarMonth)); 315 | } 316 | } 317 | 318 | /** 319 | * 返回中国农历的全名 320 | * 321 | * @return String 322 | */ 323 | public String getFullLunarName() { 324 | return String.format("%s %s %s", this, LunarData.getTraditionalYearName(this.lunarYear), 325 | LunarData.getAnimalYearName(this.lunarYear)); 326 | } 327 | 328 | /** 329 | * 创建LunarInfo中某一年的一列公历日历编码
330 | * 公历日历编码:年份+月份+天,用于查询某个公历日期在某个LunarInfo列的哪一个区间
331 | * 332 | * @param solarYear 年份 333 | * @return 公历日历编码 334 | */ 335 | private int[] builderSolarCodes(int solarYear) { 336 | if (solarYear < LunarData.MINI_YEAR || solarYear > LunarData.MAX_YEAR) { 337 | throw new IllegalArgumentException("Illegal solar year: " + solarYear); 338 | } 339 | int lunarIndex = solarYear - LunarData.MINI_YEAR; 340 | int[] solarCodes = new int[LunarData.LUNAR_INFO[lunarIndex].length]; 341 | for (int i = 0; i < solarCodes.length; i++) { 342 | if (0 == i) { // 第一个数表示闰月,不用更改 343 | solarCodes[i] = LunarData.LUNAR_INFO[lunarIndex][i]; 344 | } else if (1 == i) { 345 | if (LunarData.LUNAR_INFO[lunarIndex][1] > 999) { 346 | // 这年农历一月一日对应的公历实际是上一年的 347 | solarCodes[i] = (solarYear - 1) * 10000 + LunarData.LUNAR_INFO[lunarIndex][i]; 348 | } else { 349 | solarCodes[i] = solarYear * 10000 + LunarData.LUNAR_INFO[lunarIndex][i]; 350 | } 351 | } else { 352 | solarCodes[i] = solarYear * 10000 + LunarData.LUNAR_INFO[lunarIndex][i]; 353 | } 354 | } 355 | return solarCodes; 356 | } 357 | 358 | /** 359 | * 通过给定的农历日期,计算公历日期 360 | * 361 | * @param lunarYear  农历年 362 | * @param lunarMonth  农历月,从1开始 363 | * @param lunarDate  农历日期 364 | * @param isLeapMonth  是否为闰月 365 | */ 366 | private void computeByLunarDate(final int lunarYear, final int lunarMonth, final int lunarDate, 367 | final boolean isLeapMonth) { 368 | if (lunarYear < LunarData.MINI_YEAR || lunarYear > LunarData.MAX_YEAR) { 369 | throw new IllegalArgumentException(String.format("LunarYear must in (%d, %d)", LunarData.MINI_YEAR, 370 | LunarData.MAX_YEAR)); 371 | } 372 | this.lunarYear = lunarYear; 373 | this.lunarMonth = lunarMonth; 374 | this.dayOfLunarMonth = lunarDate; 375 | this.isLeapMonth = isLeapMonth; 376 | short code = LunarCodes.lunarMonthCode(lunarYear, lunarMonth, isLeapMonth); 377 | 378 | // 对设置的day of month 进行检查 379 | if (lunarDate == 30) { 380 | long length = LunarCodes.lengthOfMonth(lunarYear, lunarMonth, code); 381 | if (length != 30) { 382 | throw new IllegalArgumentException(String.format("农历%d年%d月, 闰月=%s,月天数为%d < %d", lunarYear, 383 | lunarMonth, isLeapMonth, length, lunarDate)); 384 | } 385 | } 386 | 387 | super.set(Calendar.YEAR, lunarYear + LunarCodes.codeYear(code)); 388 | super.set(Calendar.MONTH, LunarCodes.codeMonth(code) - 1); 389 | super.set(Calendar.DATE, LunarCodes.codeDay(code)); 390 | super.add(Calendar.DATE, lunarDate - 1); 391 | } 392 | 393 | /** 394 | * 通过给定公历日期,计算农历日期各个域值 395 | *
396 | * 这个方法可能会被调用多次,后续看能否再做优化 397 | *
398 | * 399 | * @param solarYear 公历年 400 | * @param solarMonth 公历月,0-11 401 | * @param solarDate 公历日 402 | */ 403 | private void computeBySolarDate(final int solarYear, final int solarMonth, final int solarDate) { 404 | if (solarYear < LunarData.MINI_YEAR 405 | || (solarYear == LunarData.MINI_YEAR && solarMonth < LunarData.MINI_MONTH) 406 | || (solarYear == LunarData.MINI_YEAR && solarMonth == LunarData.MINI_MONTH && solarDate < LunarData.MINI_DATE) 407 | || solarYear > LunarData.MAX_YEAR 408 | || (solarYear == LunarData.MAX_YEAR && solarMonth > LunarData.MAX_MONTH) 409 | || (solarYear == LunarData.MAX_YEAR && solarMonth == LunarData.MAX_MONTH && solarDate > LunarData.MAX_DATE) 410 | ) { 411 | // 有些中间过程日期会超出可计算范围 412 | // throw new IllegalArgumentException("Illegal solar year: " + solarYear); 413 | return; 414 | } 415 | int solarCode = solarYear * 10000 + 100 * (1 + solarMonth) + solarDate; // 公历码 416 | leapMonth = LunarData.LUNAR_INFO[solarYear - LunarData.MINI_YEAR][0]; 417 | int[] solarCodes = builderSolarCodes(solarYear); 418 | int newMonth = LunarUtils.binSearch(solarCodes, solarCode); 419 | if (-1 == newMonth) { 420 | throw new IllegalArgumentException("No lunarInfo found by solarCode: " + solarCode); 421 | } 422 | int xDate = Long.valueOf(LunarCodes.solarDateCodesDiff(solarCode, solarCodes[newMonth], Calendar.DATE)).intValue(); 423 | if (0 == newMonth) {// 在上一年 424 | int preYear = solarYear - 1; 425 | leapMonth = LunarData.LUNAR_INFO[preYear - LunarData.MINI_YEAR][0]; 426 | short[] preSolarCodes = LunarData.LUNAR_INFO[preYear - LunarData.MINI_YEAR]; 427 | // 取上年农历12月1号公历日期码 428 | int nearSolarCode = preSolarCodes[preSolarCodes.length - 1]; // 上一年12月1号 429 | // 下一年公历1月表示为了13月,这里做翻译,并计算出日期码 430 | nearSolarCode = (nearSolarCode / 100 == 13 ? preYear + 1 : preYear) * 10000 431 | + (nearSolarCode / 100 == 13 ? nearSolarCode - 1200 : nearSolarCode); 432 | if (nearSolarCode > solarCode) {// 此公历日期在上一年农历12月1号,之前,即在上年农历11月内 433 | newMonth = 11; 434 | // 取农历11月的公历码 435 | nearSolarCode = preYear * 10000 + preSolarCodes[preSolarCodes.length - 2]; 436 | } else {// 此公历日期在上一年农历12月内 437 | newMonth = 12; 438 | } 439 | xDate = Long.valueOf(LunarCodes.solarDateCodesDiff(solarCode, nearSolarCode, Calendar.DATE)).intValue(); 440 | if (xDate < 0) { 441 | throw new IllegalArgumentException("Wrong solarCode: " + solarCode); 442 | } 443 | this.dayOfLunarMonth = 1 + xDate; 444 | this.lunarYear = preYear; 445 | this.lunarMonth = newMonth; 446 | this.isLeapMonth = 0 != leapMonth && (leapMonth == newMonth); 447 | } else if (solarCodes.length == newMonth + 1 && xDate >= 30) {// 在下一年(公历12月只有30天) 448 | newMonth = 1; // 农历肯定是1月 449 | // 取下一年的公历日期码 450 | short[] nextSolarCodes = LunarData.LUNAR_INFO[solarYear + 1 - LunarData.MINI_YEAR]; 451 | // 取下一年农历1月1号公历日期码 452 | int nearSolarCode = solarYear * 10000 + nextSolarCodes[1]; // 下一年农历1月1号公历日期码 453 | xDate = Long.valueOf(LunarCodes.solarDateCodesDiff(solarCode, nearSolarCode, Calendar.DATE)).intValue(); 454 | if (xDate < 0) { 455 | throw new IllegalArgumentException("Wrong solarCode: " + solarCode); 456 | } 457 | this.dayOfLunarMonth = 1 + xDate; 458 | this.lunarYear = solarYear + 1; // 农历年到了下一年 459 | this.lunarMonth = newMonth; 460 | this.isLeapMonth = false; // 农历1月不可能为闰月 461 | } else { 462 | if (xDate < 0) { 463 | throw new IllegalArgumentException("Wrong solarCode: " + solarCode); 464 | } 465 | this.dayOfLunarMonth = 1 + xDate; 466 | this.lunarYear = solarYear; 467 | this.isLeapMonth = 0 != leapMonth && (leapMonth + 1 == newMonth); 468 | if (0 != leapMonth && leapMonth < newMonth) { 469 | this.lunarMonth = newMonth - 1; 470 | } else { 471 | this.lunarMonth = newMonth; 472 | } 473 | } 474 | } 475 | 476 | // ------------------------ getter and setter -------------------------------- 477 | 478 | public int getLunarYear() { 479 | return lunarYear; 480 | } 481 | 482 | public int getLunarMonth() { 483 | return lunarMonth; 484 | } 485 | 486 | public int getDayOfLunarMonth() { 487 | return dayOfLunarMonth; 488 | } 489 | 490 | public int getLeapMonth() { 491 | return leapMonth; 492 | } 493 | 494 | public boolean isLeapMonth() { 495 | return isLeapMonth; 496 | } 497 | } 498 | -------------------------------------------------------------------------------- /go/LunarCalendar/lunar_calendar/LunarData.go: -------------------------------------------------------------------------------- 1 | package lunar_calendar 2 | 3 | import "fmt" 4 | 5 | /** 6 | * 支持的最小日期1850-02-12 7 | */ 8 | const ( 9 | // MiniYear 支持的最小年 10 | MiniYear = 1850 11 | // MiniMonth 支持的最小月 12 | MiniMonth = 1 13 | // MiniDate 支持最小日期 14 | MiniDate = 12 15 | ) 16 | 17 | /** 18 | * 支持的最大日期2150-12-31 19 | */ 20 | const ( 21 | // MaxYear 支持的最大年 22 | MaxYear = 2150 23 | // MaxMonth 支持的最大月 24 | MaxMonth = 11 25 | // MaxDate 支持的最大日期 26 | MaxDate = 31 27 | ) 28 | 29 | var ( 30 | // lunarGan 10天干: '甲', '乙', '丙', '丁', '戊', '己', '庚', '辛', '壬', '癸' 31 | lunarGan = []rune{'\u7532', '\u4e59', '\u4e19', '\u4e01', '\u620a', '\u5df1', '\u5e9a', '\u8f9b', '\u58ec', 32 | '\u7678'} 33 | 34 | // lunarZhi 12地支: '子', '丑', '寅', '卯', '辰', '巳', '午', '未', '申', '酉', '戌', '亥' 35 | lunarZhi = []rune{'\u5b50', '\u4e11', '\u5bc5', '\u536f', '\u8fb0', '\u5df3', '\u5348', '\u672a', '\u7533', 36 | '\u9149', '\u620c', '\u4ea5'} 37 | 38 | // lunarAnimalName 12生肖:'鼠', '牛', '虎', '兔', '龍', '蛇', '馬', '羊', '猴', '雞', '犬', '豬' 39 | lunarAnimalName = []rune{'\u9f20', '\u725b', '\u864e', '\u5154', '\u9f8d', '\u86c7', '\u99ac', '\u7f8a', '\u7334', 40 | '\u96de', '\u72ac', '\u8c6c'} 41 | 42 | // lunarYearName 农历年份名: '〇', '一', '二', '三', '四', '五', '六', '七', '八', '九' 43 | lunarYearName = []rune{'\u3007', '\u4e00', '\u4e8c', '\u4e09', '\u56db', '\u4e94', 44 | '\u516d', '\u4e03', '\u516b', '\u4e5d'} 45 | 46 | // lunarMonthName 农历月份名: '正', '二', '三', '四', '五', '六', '七', '八', '九', '十', '冬', '腊' 47 | lunarMonthName = []rune{'\u6b63', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', '\u4e03', '\u516b', '\u4e5d', 48 | '\u5341', '\u51ac', '\u814a'} 49 | 50 | // lunarDayName 农历日期名: * "初一", "初二", "初三", "初四", "初五", "初六", "初七", "初八", "初九", 51 | // "初十", "十一", "十二", "十三", "十四", "十五", "十六", "十七", "十八", "十九", "二十", "廿一", "廿二", 52 | // "廿三", "廿四", "廿五", "廿六", "廿七", "廿八", "廿九", "三十" 53 | lunarDayName = []string{"\u521d\u4e00", "\u521d\u4e8c", "\u521d\u4e09", "\u521d\u56db", "\u521d\u4e94", 54 | "\u521d\u516d", "\u521d\u4e03", "\u521d\u516b", "\u521d\u4e5d", "\u521d\u5341", "\u5341\u4e00", "\u5341\u4e8c", 55 | "\u5341\u4e09", "\u5341\u56db", "\u5341\u4e94", "\u5341\u516d", "\u5341\u4e03", "\u5341\u516b", "\u5341\u4e5d", 56 | "\u4e8c\u5341", "\u5eff\u4e00", "\u5eff\u4e8c", "\u5eff\u4e09", "\u5eff\u56db", "\u5eff\u4e94", "\u5eff\u516d", 57 | "\u5eff\u4e03", "\u5eff\u516b", "\u5eff\u4e5d", "\u4e09\u5341"} 58 | 59 | // lunarInfo 农历信息: 每个数组的第一个数表示该年闰月月份,为0表示不闰月,数组中其他数表示该月初一对应的公历日期 60 | lunarInfo = [][]uint32{ 61 | {0, 212, 314, 412, 512, 610, 709, 808, 906, 1005, 1104, 1204, 1302}, // 1850 62 | {8, 201, 303, 402, 501, 531, 629, 728, 827, 925, 1024, 1123, 1222, 1321}, // 1851 63 | {0, 220, 321, 331, 419, 519, 618, 717, 815, 914, 1013, 1112, 1211, 1309}, // 1852 64 | {0, 208, 310, 408, 508, 607, 706, 805, 903, 1003, 1101, 1201, 1230}, // 1853 65 | {7, 129, 227, 329, 427, 527, 625, 725, 824, 922, 1022, 1120, 1220, 1318}, // 1854 66 | {0, 217, 318, 416, 516, 614, 714, 813, 911, 1011, 1110, 1209, 1308}, // 1855 67 | {0, 206, 307, 405, 504, 603, 702, 801, 830, 929, 1029, 1128, 1227}, // 1856 68 | {5, 126, 224, 326, 424, 523, 622, 721, 820, 918, 1018, 1116, 1216, 1315}, // 1857 69 | {0, 214, 315, 414, 513, 611, 711, 809, 907, 1007, 1106, 1205, 1304}, // 1858 70 | {0, 203, 305, 403, 503, 601, 630, 730, 828, 926, 1026, 1124, 1224}, // 1859 71 | {3, 123, 222, 322, 421, 521, 619, 718, 817, 915, 1014, 1113, 1212, 1311}, // 1860 72 | {0, 210, 311, 410, 510, 608, 708, 806, 905, 1004, 1103, 1202, 1231}, // 1861 73 | {8, 130, 301, 330, 429, 528, 627, 727, 825, 924, 1023, 1122, 1221, 1319}, // 1862 74 | {0, 218, 319, 418, 518, 616, 716, 814, 913, 1013, 1111, 1211, 1309}, // 1863 75 | {0, 208, 308, 406, 506, 604, 704, 802, 901, 1001, 1030, 1129, 1229, 1327}, // 1864 76 | {6, 127, 226, 327, 425, 525, 623, 723, 821, 920, 1020, 1118, 1218, 1317}, // 1865 77 | {0, 215, 317, 415, 514, 613, 712, 810, 909, 1009, 1107, 1207, 1306}, // 1866 78 | {0, 205, 306, 405, 504, 602, 702, 731, 829, 928, 1027, 1126, 1226}, // 1867 79 | {4, 125, 223, 324, 423, 522, 620, 720, 818, 916, 1016, 1114, 1214, 1313}, // 1868 80 | {0, 211, 313, 412, 512, 610, 709, 808, 906, 1005, 1104, 1203, 1302}, // 1869 81 | {10, 131, 302, 401, 501, 530, 629, 728, 827, 925, 1024, 1123, 1222, 1321}, // 1870 82 | {0, 219, 321, 420, 519, 618, 718, 816, 915, 1014, 1113, 1212, 1310}, // 1871 83 | {0, 209, 309, 408, 507, 606, 706, 804, 903, 1002, 1101, 1201, 1230}, // 1872 84 | {6, 129, 227, 328, 427, 526, 625, 724, 823, 922, 1021, 1120, 1220, 1318}, // 1873 85 | {0, 217, 318, 416, 516, 614, 714, 812, 911, 1010, 1109, 1209, 1308}, // 1874 86 | {0, 206, 308, 406, 505, 604, 703, 801, 831, 929, 1029, 1128, 1228}, // 1875 87 | {5, 126, 225, 326, 424, 523, 622, 721, 819, 918, 1017, 1116, 1216, 1314}, // 1876 88 | {0, 213, 315, 414, 513, 611, 711, 809, 907, 1007, 1105, 1205, 1303}, // 1877 89 | {0, 202, 304, 403, 502, 601, 630, 730, 828, 926, 1026, 1124, 1224}, // 1878 90 | {3, 122, 221, 323, 421, 521, 620, 719, 818, 916, 1015, 1114, 1213, 1312}, // 1879 91 | {0, 210, 311, 409, 509, 608, 707, 806, 905, 1004, 1103, 1202, 1231}, // 1880 92 | {7, 130, 228, 330, 428, 528, 626, 726, 825, 923, 1023, 1122, 1221, 1320}, // 1881 93 | {0, 218, 319, 418, 517, 616, 715, 814, 912, 1012, 1111, 1210, 1309}, // 1882 94 | {0, 208, 309, 407, 507, 605, 704, 803, 901, 1001, 1031, 1130, 1229}, // 1883 95 | {5, 128, 227, 327, 425, 525, 623, 722, 821, 919, 1019, 1118, 1217, 1316}, // 1884 96 | {0, 215, 317, 415, 514, 613, 712, 810, 909, 1008, 1107, 1206, 1305}, // 1885 97 | {0, 204, 306, 404, 504, 602, 702, 731, 829, 928, 1027, 1126, 1225}, // 1886 98 | {4, 124, 223, 325, 423, 523, 621, 721, 819, 917, 1017, 1115, 1215, 1313}, // 1887 99 | {0, 212, 313, 411, 511, 610, 709, 808, 906, 1005, 1104, 1203, 1302}, // 1888 100 | {12, 131, 302, 331, 430, 530, 628, 728, 826, 925, 1024, 1123, 1222, 1321}, // 1889 101 | {0, 219, 321, 419, 519, 617, 717, 816, 914, 1014, 1112, 1212, 1310}, // 1890 102 | {0, 209, 310, 409, 508, 607, 706, 805, 903, 1003, 1102, 1201, 1231}, // 1891 103 | {6, 130, 228, 328, 427, 526, 624, 724, 822, 921, 1021, 1119, 1219, 1318}, // 1892 104 | {0, 217, 318, 416, 516, 614, 713, 812, 910, 1010, 1108, 1208, 1307}, // 1893 105 | {0, 206, 307, 406, 505, 604, 703, 801, 831, 929, 1029, 1127, 1227}, // 1894 106 | {5, 126, 225, 326, 425, 524, 623, 722, 820, 919, 1018, 1117, 1216, 1315}, // 1895 107 | {0, 214, 314, 413, 513, 611, 711, 809, 907, 1007, 1105, 1205, 1303}, // 1896 108 | {0, 202, 303, 402, 502, 531, 630, 730, 828, 926, 1026, 1124, 1224}, // 1897 109 | {3, 122, 221, 322, 421, 520, 619, 719, 817, 916, 1015, 1114, 1213, 1312}, // 1898 110 | {0, 210, 312, 410, 510, 608, 708, 806, 905, 1005, 1103, 1203, 1301}, // 1899 111 | {8, 131, 301, 331, 429, 528, 627, 726, 825, 924, 1023, 1122, 1222, 1320}, // 1900 112 | {0, 219, 320, 419, 518, 616, 716, 814, 913, 1012, 1111, 1211, 1310}, // 1901 113 | {0, 208, 310, 408, 508, 606, 705, 804, 902, 1002, 1031, 1130, 1230}, // 1902 114 | {5, 129, 227, 329, 427, 527, 625, 724, 823, 921, 1020, 1119, 1219, 1317}, // 1903 115 | {0, 216, 317, 416, 515, 614, 713, 811, 910, 1009, 1107, 1207, 1306}, // 1904 116 | {0, 204, 306, 405, 504, 603, 703, 801, 830, 929, 1028, 1127, 1226}, // 1905 117 | {4, 125, 223, 325, 424, 523, 622, 721, 820, 918, 1018, 1116, 1216, 1314}, // 1906 118 | {0, 213, 314, 413, 512, 611, 710, 809, 908, 1007, 1106, 1205, 1304}, // 1907 119 | {0, 202, 303, 401, 430, 530, 629, 728, 827, 925, 1025, 1124, 1223}, // 1908 120 | {2, 122, 220, 322, 420, 519, 618, 717, 816, 914, 1014, 1113, 1213, 1311}, // 1909 121 | {0, 210, 311, 410, 509, 607, 707, 805, 904, 1003, 1102, 1202, 1301}, // 1910 122 | {6, 130, 301, 330, 429, 528, 626, 726, 824, 922, 1022, 1121, 1220, 1319}, // 1911 123 | {0, 218, 319, 417, 517, 615, 714, 813, 911, 1010, 1109, 1209, 1307}, // 1912 124 | {0, 206, 308, 407, 506, 605, 704, 802, 901, 930, 1029, 1128, 1227}, // 1913 125 | {5, 126, 225, 327, 425, 525, 623, 723, 821, 920, 1019, 1117, 1217, 1315}, // 1914 126 | {0, 214, 316, 414, 514, 613, 712, 811, 909, 1009, 1107, 1207, 1305}, // 1915 127 | {0, 203, 304, 403, 502, 601, 630, 730, 829, 927, 1027, 1125, 1225}, // 1916 128 | {2, 123, 222, 323, 421, 521, 619, 719, 818, 916, 1016, 1115, 1214, 1313}, // 1917 129 | {0, 211, 313, 411, 510, 609, 708, 807, 905, 1005, 1104, 1203, 1302}, // 1918 130 | {7, 201, 302, 401, 430, 529, 628, 727, 825, 924, 1024, 1122, 1222, 1321}, // 1919 131 | {0, 220, 320, 419, 518, 616, 716, 814, 912, 1012, 1110, 1210, 1309}, // 1920 132 | {0, 208, 310, 408, 508, 606, 705, 804, 902, 1001, 1031, 1129, 1229}, // 1921 133 | {5, 128, 227, 328, 427, 527, 625, 724, 823, 921, 1020, 1119, 1218, 1317}, // 1922 134 | {0, 216, 317, 416, 516, 614, 714, 812, 911, 1010, 1108, 1208, 1306}, // 1923 135 | {0, 205, 305, 404, 504, 602, 702, 801, 830, 929, 1028, 1127, 1226}, // 1924 136 | {4, 124, 223, 324, 423, 522, 621, 721, 819, 918, 1018, 1116, 1216, 1314}, // 1925 137 | {0, 213, 314, 412, 512, 610, 710, 808, 907, 1007, 1105, 1205, 1304}, // 1926 138 | {0, 202, 304, 402, 501, 531, 629, 729, 827, 926, 1025, 1124, 1224}, // 1927 139 | {2, 123, 221, 322, 420, 519, 618, 717, 815, 914, 1013, 1112, 1212, 1311}, // 1928 140 | {0, 210, 311, 410, 509, 607, 707, 805, 903, 1003, 1101, 1201, 1231}, // 1929 141 | {6, 130, 228, 330, 429, 528, 626, 726, 824, 922, 1022, 1120, 1220, 1319}, // 1930 142 | {0, 217, 319, 418, 517, 616, 715, 814, 912, 1011, 1110, 1209, 1308}, // 1931 143 | {0, 206, 307, 406, 506, 604, 704, 802, 901, 930, 1029, 1128, 1227}, // 1932 144 | {5, 126, 224, 326, 425, 524, 623, 723, 821, 920, 1019, 1118, 1217, 1315}, // 1933 145 | {0, 214, 315, 414, 513, 612, 712, 810, 909, 1008, 1107, 1207, 1305}, // 1934 146 | {0, 204, 305, 403, 503, 601, 701, 730, 829, 928, 1027, 1126, 1226}, // 1935 147 | {3, 124, 223, 323, 421, 521, 619, 718, 817, 916, 1015, 1114, 1214, 1313}, // 1936 148 | {0, 211, 313, 411, 510, 609, 708, 806, 905, 1004, 1103, 1203, 1302}, // 1937 149 | {7, 131, 302, 401, 430, 529, 628, 727, 825, 924, 1023, 1122, 1222, 1320}, // 1938 150 | {0, 219, 321, 420, 519, 617, 717, 815, 913, 1013, 1111, 1211, 1309}, // 1939 151 | {0, 208, 309, 408, 507, 606, 705, 804, 902, 1001, 1031, 1129, 1229}, // 1940 152 | {6, 127, 226, 328, 426, 526, 625, 724, 823, 921, 1020, 1119, 1218, 1317}, // 1941 153 | {0, 215, 317, 415, 515, 614, 713, 812, 910, 1010, 1108, 1208, 1306}, // 1942 154 | {0, 205, 306, 405, 504, 603, 702, 801, 831, 929, 1029, 1127, 1227}, // 1943 155 | {4, 125, 224, 324, 423, 522, 621, 720, 819, 917, 1017, 1116, 1215, 1314}, // 1944 156 | {0, 213, 314, 412, 512, 610, 709, 808, 906, 1006, 1105, 1205, 1303}, // 1945 157 | {0, 202, 304, 402, 501, 531, 629, 728, 827, 925, 1025, 1124, 1223}, // 1946 158 | {2, 122, 221, 323, 421, 520, 619, 718, 816, 915, 1014, 1113, 1212, 1311}, // 1947 159 | {0, 210, 311, 409, 509, 607, 707, 805, 903, 1003, 1101, 1201, 1230}, // 1948 160 | {7, 129, 228, 329, 428, 528, 626, 726, 824, 922, 1022, 1120, 1220, 1318}, // 1949 161 | {0, 217, 318, 417, 517, 615, 715, 814, 912, 1011, 1110, 1209, 1308}, // 1950 162 | {0, 206, 308, 406, 506, 605, 704, 803, 901, 1001, 1030, 1129, 1228}, // 1951 163 | {5, 127, 225, 326, 424, 524, 622, 722, 820, 919, 1019, 1117, 1217, 1315}, // 1952 164 | {0, 214, 315, 414, 513, 611, 711, 810, 908, 1008, 1107, 1206, 1305}, // 1953 165 | {0, 203, 305, 403, 503, 601, 630, 730, 828, 927, 1027, 1125, 1225}, // 1954 166 | {3, 124, 222, 324, 422, 522, 620, 719, 818, 916, 1016, 1114, 1214, 1313}, // 1955 167 | {0, 212, 312, 411, 510, 609, 708, 806, 905, 1004, 1103, 1202, 1301}, // 1956 168 | {8, 131, 302, 331, 430, 529, 628, 727, 825, 924, 1023, 1122, 1221, 1320}, // 1957 169 | {0, 218, 320, 419, 519, 617, 717, 815, 913, 1013, 1111, 1211, 1309}, // 1958 170 | {0, 208, 309, 408, 508, 606, 706, 804, 903, 1002, 1101, 1130, 1230}, // 1959 171 | {6, 128, 227, 327, 426, 525, 624, 724, 822, 921, 1020, 1119, 1218, 1317}, // 1960 172 | {0, 215, 317, 415, 515, 613, 713, 811, 910, 1010, 1108, 1208, 1306}, // 1961 173 | {0, 205, 306, 405, 504, 602, 702, 731, 830, 929, 1028, 1127, 1227}, // 1962 174 | {4, 125, 224, 325, 424, 523, 621, 721, 819, 918, 1017, 1116, 1216, 1315}, // 1963 175 | {0, 213, 314, 412, 512, 610, 709, 808, 906, 1006, 1104, 1204, 1303}, // 1964 176 | {0, 202, 303, 402, 501, 531, 629, 728, 827, 925, 1024, 1123, 1223}, // 1965 177 | {3, 121, 220, 322, 421, 520, 619, 718, 816, 915, 1014, 1112, 1212, 1311}, // 1966 178 | {0, 209, 311, 410, 509, 608, 708, 806, 904, 1004, 1102, 1202, 1231}, // 1967 179 | {7, 130, 228, 329, 427, 527, 626, 725, 824, 922, 1022, 1120, 1220, 1318}, // 1968 180 | {0, 217, 318, 417, 516, 615, 714, 813, 912, 1011, 1110, 1209, 1308}, // 1969 181 | {0, 206, 308, 406, 505, 604, 703, 802, 901, 930, 1030, 1129, 1228}, // 1970 182 | {5, 127, 225, 327, 425, 524, 623, 722, 821, 919, 1019, 1118, 1218, 1316}, // 1971 183 | {0, 215, 315, 414, 513, 611, 711, 809, 908, 1007, 1106, 1206, 1304}, // 1972 184 | {0, 203, 305, 403, 503, 601, 630, 730, 828, 926, 1026, 1125, 1224}, // 1973 185 | {4, 123, 222, 324, 422, 522, 620, 719, 818, 916, 1015, 1114, 1214, 1312}, // 1974 186 | {0, 211, 313, 412, 511, 610, 709, 807, 906, 1005, 1103, 1203, 1301}, // 1975 187 | {8, 131, 301, 331, 429, 529, 627, 727, 825, 924, 1023, 1121, 1221, 1319}, // 1976 188 | {0, 218, 320, 418, 518, 617, 716, 815, 913, 1013, 1111, 1211, 1309}, // 1977 189 | {0, 207, 309, 407, 507, 606, 705, 804, 903, 1002, 1101, 1130, 1230}, // 1978 190 | {6, 128, 227, 328, 426, 526, 624, 724, 823, 921, 1021, 1120, 1219, 1318}, // 1979 191 | {0, 216, 317, 415, 514, 613, 712, 811, 909, 1009, 1108, 1207, 1306}, // 1980 192 | {0, 205, 306, 405, 504, 602, 702, 731, 829, 928, 1028, 1126, 1226}, // 1981 193 | {4, 125, 224, 325, 424, 523, 621, 721, 819, 917, 1017, 1115, 1215, 1314}, // 1982 194 | {0, 213, 315, 413, 513, 611, 710, 809, 907, 1006, 1105, 1204, 1303}, // 1983 195 | {10, 202, 303, 401, 501, 531, 629, 728, 827, 925, 1024, 1123, 1222, 1321}, // 1984 196 | {0, 220, 321, 420, 520, 618, 718, 816, 915, 1014, 1112, 1212, 1310}, // 1985 197 | {0, 209, 310, 409, 509, 607, 707, 806, 904, 1004, 1102, 1202, 1231}, // 1986 198 | {6, 129, 228, 329, 428, 527, 626, 726, 824, 923, 1023, 1121, 1221, 1319}, // 1987 199 | {0, 217, 318, 416, 516, 614, 714, 812, 911, 1011, 1109, 1209, 1308}, // 1988 200 | {0, 206, 308, 406, 505, 604, 703, 802, 831, 930, 1029, 1128, 1228}, // 1989 201 | {5, 127, 225, 327, 425, 524, 623, 722, 820, 919, 1018, 1117, 1217, 1316}, // 1990 202 | {0, 215, 316, 415, 514, 612, 712, 810, 908, 1008, 1106, 1206, 1305}, // 1991 203 | {0, 204, 304, 403, 503, 601, 630, 730, 828, 926, 1026, 1124, 1224}, // 1992 204 | {3, 123, 221, 323, 422, 521, 620, 719, 818, 916, 1015, 1114, 1213, 1312}, // 1993 205 | {0, 210, 312, 411, 511, 609, 709, 807, 906, 1005, 1103, 1203, 1301}, // 1994 206 | {8, 131, 301, 331, 430, 529, 628, 727, 826, 925, 1024, 1122, 1222, 1320}, // 1995 207 | {0, 219, 319, 418, 517, 616, 716, 814, 913, 1012, 1111, 1211, 1309}, // 1996 208 | {0, 207, 309, 407, 507, 605, 705, 803, 902, 1002, 1031, 1130, 1230}, // 1997 209 | {5, 128, 227, 328, 426, 526, 624, 723, 822, 921, 1020, 1119, 1219, 1317}, // 1998 210 | {0, 216, 318, 416, 515, 614, 713, 811, 910, 1009, 1108, 1208, 1307}, // 1999 211 | {0, 205, 306, 405, 504, 602, 702, 731, 829, 928, 1027, 1126, 1226}, // 2000 212 | {4, 124, 223, 325, 423, 523, 621, 721, 819, 917, 1017, 1115, 1215, 1313}, // 2001 213 | {0, 212, 314, 413, 512, 611, 710, 809, 907, 1006, 1105, 1204, 1303}, // 2002 214 | {0, 201, 303, 402, 501, 531, 630, 729, 828, 926, 1025, 1124, 1223}, // 2003 215 | {2, 122, 220, 321, 419, 519, 618, 717, 816, 914, 1014, 1112, 1212, 1310}, // 2004 216 | {0, 209, 310, 409, 508, 607, 706, 805, 904, 1003, 1102, 1201, 1231}, // 2005 217 | {7, 129, 228, 329, 428, 527, 626, 725, 824, 922, 1022, 1121, 1220, 1319}, // 2006 218 | {0, 218, 319, 417, 517, 615, 714, 813, 911, 1011, 1110, 1210, 1308}, // 2007 219 | {0, 207, 308, 406, 505, 604, 703, 801, 831, 929, 1029, 1128, 1227}, // 2008 220 | {5, 126, 225, 327, 425, 524, 623, 722, 820, 919, 1018, 1117, 1216, 1315}, // 2009 221 | {0, 214, 316, 414, 514, 612, 712, 810, 908, 1008, 1106, 1206, 1304}, // 2010 222 | {0, 203, 305, 403, 503, 602, 701, 731, 829, 927, 1027, 1125, 1225}, // 2011 223 | {4, 123, 222, 322, 421, 521, 619, 719, 817, 916, 1015, 1114, 1213, 1312}, // 2012 224 | {0, 210, 312, 410, 510, 608, 708, 807, 905, 1005, 1103, 1203, 1301}, // 2013 225 | {9, 131, 301, 331, 429, 529, 627, 727, 825, 924, 1024, 1122, 1222, 1320}, // 2014 226 | {0, 219, 320, 419, 518, 616, 716, 814, 913, 1013, 1112, 1211, 1310}, // 2015 227 | {0, 208, 309, 407, 507, 605, 704, 803, 901, 1001, 1031, 1129, 1229}, // 2016 228 | {6, 128, 226, 328, 426, 526, 624, 723, 822, 920, 1020, 1118, 1218, 1317}, // 2017 229 | {0, 216, 317, 416, 515, 614, 713, 811, 910, 1009, 1108, 1207, 1306}, // 2018 230 | {0, 205, 307, 405, 505, 603, 703, 801, 830, 929, 1028, 1126, 1226}, // 2019 231 | {4, 125, 223, 324, 423, 523, 621, 721, 819, 917, 1017, 1115, 1215, 1313}, // 2020 232 | {0, 212, 313, 412, 512, 610, 710, 808, 907, 1006, 1105, 1204, 1303}, // 2021 233 | {0, 201, 303, 401, 501, 530, 629, 729, 827, 926, 1025, 1124, 1223}, // 2022 234 | {2, 122, 220, 322, 420, 519, 618, 718, 816, 915, 1015, 1113, 1213, 1311}, // 2023 235 | {0, 210, 310, 409, 508, 606, 706, 804, 903, 1003, 1101, 1201, 1231}, // 2024 236 | {6, 129, 228, 329, 428, 527, 625, 725, 823, 922, 1021, 1120, 1220, 1319}, // 2025 237 | {0, 217, 319, 417, 517, 615, 714, 813, 911, 1010, 1109, 1209, 1308}, // 2026 238 | {0, 206, 308, 407, 506, 605, 704, 802, 901, 930, 1029, 1128, 1228}, // 2027 239 | {5, 126, 225, 326, 425, 524, 623, 722, 820, 919, 1018, 1116, 1216, 1315}, // 2028 240 | {0, 213, 315, 414, 513, 612, 711, 810, 908, 1008, 1106, 1205, 1304}, // 2029 241 | {0, 203, 304, 403, 502, 601, 701, 730, 829, 927, 1027, 1125, 1225}, // 2030 242 | {3, 123, 221, 323, 422, 521, 620, 719, 818, 917, 1016, 1115, 1214, 1313}, // 2031 243 | {0, 211, 312, 410, 509, 608, 707, 806, 905, 1004, 1103, 1203, 1301}, // 2032 244 | {11, 131, 301, 331, 429, 528, 627, 726, 825, 923, 1023, 1122, 1222, 1320}, // 2033 245 | {0, 219, 320, 419, 518, 616, 716, 814, 913, 1012, 1111, 1211, 1309}, // 2034 246 | {0, 208, 310, 408, 508, 606, 705, 804, 902, 1001, 1031, 1130, 1229}, // 2035 247 | {6, 128, 227, 328, 426, 526, 624, 723, 822, 920, 1019, 1118, 1217, 1316}, // 2036 248 | {0, 215, 317, 416, 515, 614, 713, 811, 910, 1009, 1107, 1207, 1305}, // 2037 249 | {0, 204, 306, 405, 504, 603, 702, 801, 830, 929, 1028, 1126, 1226}, // 2038 250 | {5, 124, 223, 325, 423, 523, 622, 721, 820, 918, 1018, 1116, 1216, 1314}, // 2039 251 | {0, 212, 313, 411, 511, 610, 709, 808, 906, 1006, 1105, 1204, 1303}, // 2040 252 | {0, 201, 302, 401, 430, 530, 628, 728, 827, 925, 1025, 1124, 1223}, // 2041 253 | {2, 122, 220, 322, 420, 519, 618, 717, 816, 914, 1014, 1113, 1212, 1311}, // 2042 254 | {0, 210, 311, 410, 509, 607, 707, 805, 903, 1003, 1102, 1201, 1231}, // 2043 255 | {7, 130, 229, 329, 428, 527, 625, 725, 823, 921, 1021, 1119, 1219, 1318}, // 2044 256 | {0, 217, 319, 417, 517, 615, 714, 813, 911, 1010, 1109, 1208, 1307}, // 2045 257 | {0, 206, 308, 406, 506, 604, 704, 802, 901, 930, 1029, 1128, 1227}, // 2046 258 | {5, 126, 225, 326, 425, 525, 623, 723, 821, 920, 1019, 1117, 1217, 1315}, // 2047 259 | {0, 214, 314, 413, 513, 611, 711, 810, 908, 1008, 1106, 1205, 1304}, // 2048 260 | {0, 202, 304, 402, 502, 531, 630, 730, 828, 927, 1027, 1125, 1225}, // 2049 261 | {3, 123, 221, 323, 421, 521, 619, 719, 817, 916, 1016, 1114, 1214, 1313}, // 2050 262 | {0, 211, 313, 411, 510, 609, 708, 806, 905, 1005, 1103, 1203, 1302}, // 2051 263 | {8, 201, 301, 331, 429, 528, 627, 726, 824, 923, 1022, 1121, 1221, 1320}, // 2052 264 | {0, 219, 320, 419, 518, 616, 716, 814, 912, 1012, 1110, 1210, 1309}, // 2053 265 | {0, 208, 309, 408, 508, 606, 705, 804, 902, 1001, 1031, 1129, 1229}, // 2054 266 | {6, 128, 226, 328, 427, 526, 625, 724, 823, 921, 1020, 1119, 1218, 1317}, // 2055 267 | {0, 215, 316, 415, 515, 613, 713, 811, 910, 1009, 1107, 1207, 1305}, // 2056 268 | {0, 204, 305, 404, 504, 602, 702, 731, 830, 928, 1028, 1126, 1226}, // 2057 269 | {4, 124, 223, 324, 423, 522, 621, 720, 819, 918, 1017, 1116, 1216, 1314}, // 2058 270 | {0, 212, 314, 412, 512, 610, 710, 808, 907, 1006, 1105, 1205, 1304}, // 2059 271 | {0, 202, 303, 401, 430, 530, 628, 727, 826, 924, 1024, 1123, 1223}, // 2060 272 | {3, 121, 220, 322, 420, 519, 618, 717, 815, 914, 1013, 1112, 1212, 1311}, // 2061 273 | {0, 209, 311, 410, 509, 607, 707, 805, 903, 1003, 1101, 1201, 1231}, // 2062 274 | {7, 129, 228, 330, 428, 528, 626, 726, 824, 922, 1022, 1120, 1220, 1318}, // 2063 275 | {0, 217, 318, 417, 516, 615, 714, 813, 911, 1010, 1109, 1208, 1307}, // 2064 276 | {0, 205, 307, 406, 505, 604, 704, 802, 901, 930, 1029, 1128, 1227}, // 2065 277 | {5, 126, 224, 326, 424, 524, 623, 722, 821, 919, 1019, 1117, 1217, 1315}, // 2066 278 | {0, 214, 315, 414, 513, 612, 711, 810, 909, 1008, 1107, 1206, 1305}, // 2067 279 | {0, 203, 304, 402, 502, 531, 629, 729, 828, 926, 1026, 1125, 1224}, // 2068 280 | {4, 123, 221, 323, 421, 521, 619, 718, 817, 915, 1015, 1114, 1214, 1312}, // 2069 281 | {0, 211, 312, 411, 510, 609, 708, 806, 905, 1004, 1103, 1203, 1301}, // 2070 282 | {8, 131, 302, 331, 430, 529, 628, 727, 825, 924, 1023, 1122, 1221, 1320}, // 2071 283 | {0, 219, 320, 418, 518, 616, 716, 814, 912, 1012, 1110, 1210, 1308}, // 2072 284 | {0, 207, 309, 407, 507, 606, 705, 804, 902, 1001, 1031, 1129, 1229}, // 2073 285 | {6, 127, 226, 327, 426, 526, 624, 724, 822, 921, 1020, 1119, 1218, 1317}, // 2074 286 | {0, 215, 317, 415, 515, 613, 713, 812, 910, 1010, 1108, 1208, 1306}, // 2075 287 | {0, 205, 305, 404, 503, 602, 701, 731, 829, 928, 1028, 1126, 1226}, // 2076 288 | {4, 124, 223, 324, 423, 522, 620, 720, 818, 917, 1017, 1116, 1215, 1314}, // 2077 289 | {0, 212, 314, 412, 512, 610, 709, 808, 906, 1006, 1105, 1204, 1303}, // 2078 290 | {0, 202, 303, 402, 501, 531, 629, 728, 827, 925, 1025, 1123, 1223}, // 2079 291 | {3, 122, 221, 321, 420, 519, 618, 717, 815, 914, 1013, 1111, 1211, 1310}, // 2080 292 | {0, 209, 310, 409, 509, 607, 707, 805, 903, 1003, 1101, 1130, 1230}, // 2081 293 | {7, 129, 227, 329, 428, 528, 626, 725, 824, 922, 1022, 1120, 1219, 1318}, // 2082 294 | {0, 217, 318, 417, 517, 615, 715, 813, 912, 1011, 1110, 1209, 1308}, // 2083 295 | {0, 206, 307, 405, 505, 603, 703, 802, 831, 930, 1029, 1128, 1227}, // 2084 296 | {5, 126, 224, 326, 424, 523, 622, 722, 820, 919, 1019, 1117, 1217, 1315}, // 2085 297 | {0, 214, 315, 414, 513, 611, 711, 809, 908, 1008, 1106, 1206, 1305}, // 2086 298 | {0, 203, 305, 403, 503, 601, 630, 730, 828, 927, 1026, 1125, 1225}, // 2087 299 | {4, 124, 222, 323, 421, 521, 619, 718, 817, 915, 1014, 1113, 1213, 1312}, // 2088 300 | {0, 210, 312, 411, 510, 609, 708, 806, 904, 1004, 1102, 1202, 1301}, // 2089 301 | {8, 130, 301, 331, 430, 529, 628, 727, 825, 924, 1023, 1121, 1221, 1320}, // 2090 302 | {0, 218, 320, 419, 518, 617, 716, 815, 913, 1013, 1111, 1210, 1309}, // 2091 303 | {0, 207, 308, 407, 506, 605, 705, 803, 902, 1001, 1031, 1129, 1229}, // 2092 304 | {6, 127, 225, 327, 426, 525, 624, 723, 822, 921, 1020, 1119, 1218, 1317}, // 2093 305 | {0, 215, 316, 415, 514, 613, 712, 811, 910, 1009, 1108, 1208, 1306}, // 2094 306 | {0, 205, 306, 405, 504, 602, 702, 731, 830, 928, 1028, 1127, 1227}, // 2095 307 | {4, 125, 224, 324, 423, 522, 620, 720, 818, 916, 1016, 1115, 1215, 1313}, // 2096 308 | {0, 212, 314, 412, 512, 610, 709, 807, 906, 1005, 1104, 1204, 1302}, // 2097 309 | {0, 201, 303, 402, 501, 531, 629, 728, 826, 925, 1024, 1123, 1222}, // 2098 310 | {2, 121, 220, 322, 420, 520, 619, 718, 816, 915, 1014, 1112, 1212, 1310}, // 2099 311 | {0, 209, 311, 410, 509, 608, 707, 806, 904, 1004, 1102, 1201, 1231}, // 2010 312 | {7, 129, 228, 330, 428, 528, 626, 726, 825, 923, 1023, 1121, 1220, 1319}, //2101 313 | {0, 217, 319, 417, 517, 616, 715, 814, 912, 1012, 1111, 1210, 1309}, //2102 314 | {0, 207, 308, 407, 506, 605, 704, 803, 901, 1001, 1031, 1130, 1229}, //2103 315 | {5, 128, 226, 327, 425, 524, 623, 722, 821, 919, 1019, 1118, 1217, 1316}, //2104 316 | {0, 215, 316, 415, 514, 612, 712, 810, 908, 1008, 1107, 1206, 1305}, //2105 317 | {0, 204, 306, 404, 504, 602, 701, 731, 829, 927, 1027, 1125, 1225}, //2106 318 | {4, 124, 223, 325, 423, 523, 621, 720, 819, 917, 1016, 1115, 1214, 1313}, //2107 319 | {0, 212, 313, 411, 511, 609, 709, 807, 906, 1005, 1103, 1203, 1301}, //2108 320 | {9, 131, 302, 331, 430, 530, 628, 728, 826, 925, 1024, 1122, 1222, 1320}, //2109 321 | {0, 219, 320, 419, 519, 617, 717, 816, 914, 1014, 1112, 1211, 1310}, //2110 322 | {0, 208, 310, 408, 508, 606, 706, 805, 903, 1003, 1101, 1201, 1231}, //2111 323 | {6, 129, 227, 328, 426, 526, 624, 724, 822, 921, 1021, 1119, 1219, 1318}, //2112 324 | {0, 216, 318, 416, 515, 614, 713, 811, 910, 1010, 1108, 1208, 1307}, //2113 325 | {0, 206, 307, 406, 505, 603, 703, 801, 830, 929, 1028, 1127, 1227}, //2114 326 | {4, 126, 225, 326, 425, 524, 622, 722, 820, 918, 1018, 1116, 1216, 1315}, //2115 327 | {0, 214, 314, 413, 512, 611, 710, 809, 907, 1006, 1105, 1204, 1303}, //2116 328 | {0, 202, 303, 402, 502, 531, 630, 729, 828, 926, 1025, 1124, 1223}, //2117 329 | {3, 122, 220, 322, 421, 520, 619, 719, 817, 916, 1015, 1113, 1213, 1311}, //2118 330 | {0, 210, 311, 410, 509, 608, 708, 806, 905, 1004, 1103, 1202, 1301}, //2119 331 | {7, 130, 229, 329, 428, 527, 626, 725, 824, 923, 1022, 1121, 1220, 1319}, //2120 332 | {0, 217, 319, 417, 517, 615, 715, 813, 912, 1011, 1110, 1210, 1309}, //2121 333 | {0, 207, 308, 407, 506, 605, 704, 802, 901, 930, 1030, 1129, 1229}, //2122 334 | {5, 127, 226, 328, 426, 525, 624, 723, 821, 920, 1019, 1118, 1218, 1317}, //2123 335 | {0, 215, 316, 414, 514, 612, 712, 810, 908, 1008, 1106, 1206, 1305}, //2124 336 | {0, 203, 305, 404, 503, 602, 701, 731, 829, 927, 1027, 1125, 1225}, //2125 337 | {4, 123, 222, 324, 423, 522, 621, 720, 819, 917, 1016, 1115, 1214, 1313}, //2126 338 | {0, 211, 313, 412, 511, 610, 710, 808, 906, 1006, 1104, 1204, 1302}, //2127 339 | {11, 201, 301, 331, 429, 529, 628, 727, 826, 924, 1024, 1122, 1222, 1320}, //2128 340 | {0, 219, 320, 419, 518, 617, 716, 815, 914, 1013, 1112, 1211, 1310}, //2129 341 | {0, 208, 310, 408, 508, 606, 705, 804, 903, 1002, 1101, 1201, 1230}, //2130 342 | {6, 129, 227, 329, 427, 527, 625, 724, 823, 921, 1021, 1120, 1220, 1318}, //2131 343 | {0, 217, 317, 416, 515, 614, 713, 811, 910, 1009, 1108, 1208, 1306}, //2132 344 | {0, 205, 307, 405, 505, 603, 703, 801, 830, 928, 1028, 1127, 1226}, //2133 345 | {5, 125, 224, 326, 424, 524, 622, 722, 820, 918, 1018, 1116, 1216, 1314}, //2134 346 | {0, 213, 315, 413, 513, 612, 711, 809, 908, 1007, 1106, 1205, 1304}, //2135 347 | {0, 202, 303, 401, 501, 531, 629, 729, 827, 926, 1025, 1124, 1223}, //2136 348 | {2, 122, 220, 322, 420, 520, 618, 718, 817, 915, 1015, 1113, 1213, 1311}, //2137 349 | {0, 210, 311, 410, 509, 608, 707, 806, 904, 1004, 1103, 1202, 1301}, //2138 350 | {7, 130, 301, 330, 429, 528, 626, 726, 824, 923, 1023, 1122, 1221, 1320}, //2139 351 | {0, 218, 319, 417, 517, 615, 714, 813, 911, 1011, 1110, 1209, 1308}, //2140 352 | {0, 207, 308, 407, 506, 605, 704, 802, 901, 930, 1030, 1128, 1228}, //2141 353 | {5, 127, 226, 327, 426, 525, 624, 723, 821, 919, 1019, 1117, 1217, 1316}, //2142 354 | {0, 215, 316, 415, 515, 613, 713, 811, 909, 1008, 1107, 1206, 1305}, //2143 355 | {0, 204, 304, 403, 503, 602, 701, 730, 829, 927, 1027, 1125, 1224}, //2144 356 | {4, 123, 222, 323, 422, 522, 620, 720, 818, 917, 1016, 1115, 1214, 1313}, //2145 357 | {0, 211, 312, 411, 511, 609, 709, 807, 906, 1006, 1104, 1204, 1302}, //2146 358 | {0, 201, 302, 331, 430, 529, 628, 728, 826, 925, 1025, 1123, 1223}, //2147 359 | {1, 121, 220, 320, 419, 518, 616, 716, 814, 913, 1013, 1111, 1211, 1310}, //2148 360 | {0, 208, 310, 408, 508, 606, 705, 804, 902, 1002, 1031, 1130, 1230}, //2149 361 | {6, 129, 227, 329, 427, 527, 625, 724, 822, 921, 1020, 1119, 1219, 1318}, //2150 362 | } 363 | ) 364 | 365 | // GetDayName 获取农历日的表示 366 | func GetDayName(lunarDay int32) string { 367 | return lunarDayName[lunarDay-1] 368 | } 369 | 370 | // 获取农历月份 371 | func GetMonthName(lunarMonth int32) rune { 372 | return lunarMonthName[lunarMonth-1] 373 | } 374 | 375 | // GetYearName 获取农历年份 376 | func GetYearName(lunarYear int32) string { 377 | var yearName string 378 | yearName = fmt.Sprintf("%c", lunarYearName[lunarYear/1000]) 379 | yearName += fmt.Sprintf("%c", lunarYearName[lunarYear%1000/100]) 380 | yearName += fmt.Sprintf("%c", lunarYearName[lunarYear%100/10]) 381 | yearName += fmt.Sprintf("%c", lunarYearName[lunarYear%10]) 382 | return yearName 383 | } 384 | 385 | // GetTraditionalYearName 传统天干地支年名称 386 | func GetTraditionalYearName(lunarYear int32) string { 387 | lunarYear = lunarYear - 1804 // 1804年是甲子年 388 | return fmt.Sprintf("%c", lunarGan[lunarYear%10]) + fmt.Sprintf("%c", lunarZhi[lunarYear%12]) + 389 | "\u5e74" 390 | } 391 | 392 | // GetAnimalYearName 获取生肖名 393 | func GetAnimalYearName(lunarYear int32) string { 394 | return fmt.Sprintf("%c", lunarAnimalName[(lunarYear-4)%12]) 395 | } 396 | -------------------------------------------------------------------------------- /java/lunar/src/main/java/com/github/heqiao2010/lunar/LunarData.java: -------------------------------------------------------------------------------- 1 | package com.github.heqiao2010.lunar; 2 | 3 | public class LunarData { 4 | /** 5 | * 支持的最小日期1850-02-12 6 | */ 7 | public final static int MINI_YEAR = 1850; 8 | public final static int MINI_MONTH = 1; 9 | public final static int MINI_DATE = 12; 10 | /** 11 | * 支持的最大日期2150-12-31 12 | */ 13 | public final static int MAX_YEAR = 2150; 14 | public final static int MAX_MONTH = 11; 15 | public final static int MAX_DATE = 31; 16 | /** 17 | * 10天干 18 | * '甲', '乙', '丙', '丁', '戊', '己', '庚', '辛', '壬', '癸' 19 | */ 20 | static final char[] LunarGan = {'\u7532', '\u4e59', '\u4e19', '\u4e01', '\u620a', '\u5df1', '\u5e9a', 21 | '\u8f9b', '\u58ec', '\u7678'}; 22 | /** 23 | * 12地支 24 | * '子', '丑', '寅', '卯', '辰', '巳', '午', '未', '申', '酉', '戌', '亥' 25 | */ 26 | static final char[] LunarZhi = {'\u5b50', '\u4e11', '\u5bc5', '\u536f', '\u8fb0', '\u5df3', '\u5348', 27 | '\u672a', '\u7533', '\u9149', '\u620c', '\u4ea5'}; 28 | /** 29 | * 12生肖 30 | * '鼠', '牛', '虎', '兔', '龍', '蛇', '馬', '羊', '猴', '雞', '犬', '豬' 31 | */ 32 | static final char[] LunarAnimalName = {'\u9f20', '\u725b', '\u864e', '\u5154', '\u9f8d', '\u86c7', 33 | '\u99ac', '\u7f8a', '\u7334', '\u96de', '\u72ac', '\u8c6c'}; 34 | /** 35 | * 农历年份名 36 | * '〇', '一', '二', '三', '四', '五', '六', '七', '八', '九' 37 | */ 38 | static final char[] LunarYearName = {'\u3007', '\u4e00', '\u4e8c', '\u4e09', '\u56db', '\u4e94', 39 | '\u516d', '\u4e03', '\u516b', '\u4e5d'}; 40 | /** 41 | * 农历月份名 42 | * '正', '二', '三', '四', '五', '六', '七', '八', '九', '十', '冬', '腊' 43 | */ 44 | static final char[] LunarMonthName = {'\u6b63', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', 45 | '\u4e03', '\u516b', '\u4e5d', '\u5341', '\u51ac', '\u814a'}; 46 | /** 47 | * 农历日期名 48 | * "初一", "初二", "初三", "初四", "初五", "初六", "初七", "初八", "初九", 49 | * "初十", "十一", "十二", "十三", "十四", "十五", "十六", "十七", "十八", "十九", "二十", "廿一", "廿二", 50 | * "廿三", "廿四", "廿五", "廿六", "廿七", "廿八", "廿九", "三十" 51 | */ 52 | static final String[] LunarDayName = {"\u521d\u4e00", "\u521d\u4e8c", "\u521d\u4e09", "\u521d\u56db", 53 | "\u521d\u4e94", "\u521d\u516d", "\u521d\u4e03", "\u521d\u516b", "\u521d\u4e5d", "\u521d\u5341", 54 | "\u5341\u4e00", "\u5341\u4e8c", "\u5341\u4e09", "\u5341\u56db", "\u5341\u4e94", "\u5341\u516d", 55 | "\u5341\u4e03", "\u5341\u516b", "\u5341\u4e5d", "\u4e8c\u5341", "\u5eff\u4e00", "\u5eff\u4e8c", 56 | "\u5eff\u4e09", "\u5eff\u56db", "\u5eff\u4e94", "\u5eff\u516d", "\u5eff\u4e03", "\u5eff\u516b", 57 | "\u5eff\u4e5d", "\u4e09\u5341"}; 58 | /** 59 | * 农历信息.
60 | * 每个数组的第一个数表示该年闰月月份,为0表示不闰月
61 | * 数组中其他数表示该月初一对应的公历日期
62 | */ 63 | final static short[][] LUNAR_INFO = { 64 | {0, 212, 314, 412, 512, 610, 709, 808, 906, 1005, 1104, 1204, 1302}, // 1850 65 | {8, 201, 303, 402, 501, 531, 629, 728, 827, 925, 1024, 1123, 1222, 1321}, // 1851 66 | {0, 220, 321, 331, 419, 519, 618, 717, 815, 914, 1013, 1112, 1211, 1309}, // 1852 67 | {0, 208, 310, 408, 508, 607, 706, 805, 903, 1003, 1101, 1201, 1230}, // 1853 68 | {7, 129, 227, 329, 427, 527, 625, 725, 824, 922, 1022, 1120, 1220, 1318}, // 1854 69 | {0, 217, 318, 416, 516, 614, 714, 813, 911, 1011, 1110, 1209, 1308}, // 1855 70 | {0, 206, 307, 405, 504, 603, 702, 801, 830, 929, 1029, 1128, 1227}, // 1856 71 | {5, 126, 224, 326, 424, 523, 622, 721, 820, 918, 1018, 1116, 1216, 1315}, // 1857 72 | {0, 214, 315, 414, 513, 611, 711, 809, 907, 1007, 1106, 1205, 1304}, // 1858 73 | {0, 203, 305, 403, 503, 601, 630, 730, 828, 926, 1026, 1124, 1224}, // 1859 74 | {3, 123, 222, 322, 421, 521, 619, 718, 817, 915, 1014, 1113, 1212, 1311}, // 1860 75 | {0, 210, 311, 410, 510, 608, 708, 806, 905, 1004, 1103, 1202, 1231}, // 1861 76 | {8, 130, 301, 330, 429, 528, 627, 727, 825, 924, 1023, 1122, 1221, 1319}, // 1862 77 | {0, 218, 319, 418, 518, 616, 716, 814, 913, 1013, 1111, 1211, 1309}, // 1863 78 | {0, 208, 308, 406, 506, 604, 704, 802, 901, 1001, 1030, 1129, 1229, 1327}, // 1864 79 | {6, 127, 226, 327, 425, 525, 623, 723, 821, 920, 1020, 1118, 1218, 1317}, // 1865 80 | {0, 215, 317, 415, 514, 613, 712, 810, 909, 1009, 1107, 1207, 1306}, // 1866 81 | {0, 205, 306, 405, 504, 602, 702, 731, 829, 928, 1027, 1126, 1226}, // 1867 82 | {4, 125, 223, 324, 423, 522, 620, 720, 818, 916, 1016, 1114, 1214, 1313}, // 1868 83 | {0, 211, 313, 412, 512, 610, 709, 808, 906, 1005, 1104, 1203, 1302}, // 1869 84 | {10, 131, 302, 401, 501, 530, 629, 728, 827, 925, 1024, 1123, 1222, 1321}, // 1870 85 | {0, 219, 321, 420, 519, 618, 718, 816, 915, 1014, 1113, 1212, 1310}, // 1871 86 | {0, 209, 309, 408, 507, 606, 706, 804, 903, 1002, 1101, 1201, 1230}, // 1872 87 | {6, 129, 227, 328, 427, 526, 625, 724, 823, 922, 1021, 1120, 1220, 1318}, // 1873 88 | {0, 217, 318, 416, 516, 614, 714, 812, 911, 1010, 1109, 1209, 1308}, // 1874 89 | {0, 206, 308, 406, 505, 604, 703, 801, 831, 929, 1029, 1128, 1228}, // 1875 90 | {5, 126, 225, 326, 424, 523, 622, 721, 819, 918, 1017, 1116, 1216, 1314}, // 1876 91 | {0, 213, 315, 414, 513, 611, 711, 809, 907, 1007, 1105, 1205, 1303}, // 1877 92 | {0, 202, 304, 403, 502, 601, 630, 730, 828, 926, 1026, 1124, 1224}, // 1878 93 | {3, 122, 221, 323, 421, 521, 620, 719, 818, 916, 1015, 1114, 1213, 1312}, // 1879 94 | {0, 210, 311, 409, 509, 608, 707, 806, 905, 1004, 1103, 1202, 1231}, // 1880 95 | {7, 130, 228, 330, 428, 528, 626, 726, 825, 923, 1023, 1122, 1221, 1320}, // 1881 96 | {0, 218, 319, 418, 517, 616, 715, 814, 912, 1012, 1111, 1210, 1309}, // 1882 97 | {0, 208, 309, 407, 507, 605, 704, 803, 901, 1001, 1031, 1130, 1229}, // 1883 98 | {5, 128, 227, 327, 425, 525, 623, 722, 821, 919, 1019, 1118, 1217, 1316}, // 1884 99 | {0, 215, 317, 415, 514, 613, 712, 810, 909, 1008, 1107, 1206, 1305}, // 1885 100 | {0, 204, 306, 404, 504, 602, 702, 731, 829, 928, 1027, 1126, 1225}, // 1886 101 | {4, 124, 223, 325, 423, 523, 621, 721, 819, 917, 1017, 1115, 1215, 1313}, // 1887 102 | {0, 212, 313, 411, 511, 610, 709, 808, 906, 1005, 1104, 1203, 1302}, // 1888 103 | {12, 131, 302, 331, 430, 530, 628, 728, 826, 925, 1024, 1123, 1222, 1321}, // 1889 104 | {0, 219, 321, 419, 519, 617, 717, 816, 914, 1014, 1112, 1212, 1310}, // 1890 105 | {0, 209, 310, 409, 508, 607, 706, 805, 903, 1003, 1102, 1201, 1231}, // 1891 106 | {6, 130, 228, 328, 427, 526, 624, 724, 822, 921, 1021, 1119, 1219, 1318}, // 1892 107 | {0, 217, 318, 416, 516, 614, 713, 812, 910, 1010, 1108, 1208, 1307}, // 1893 108 | {0, 206, 307, 406, 505, 604, 703, 801, 831, 929, 1029, 1127, 1227}, // 1894 109 | {5, 126, 225, 326, 425, 524, 623, 722, 820, 919, 1018, 1117, 1216, 1315}, // 1895 110 | {0, 214, 314, 413, 513, 611, 711, 809, 907, 1007, 1105, 1205, 1303}, // 1896 111 | {0, 202, 303, 402, 502, 531, 630, 730, 828, 926, 1026, 1124, 1224}, // 1897 112 | {3, 122, 221, 322, 421, 520, 619, 719, 817, 916, 1015, 1114, 1213, 1312}, // 1898 113 | {0, 210, 312, 410, 510, 608, 708, 806, 905, 1005, 1103, 1203, 1301}, // 1899 114 | {8, 131, 301, 331, 429, 528, 627, 726, 825, 924, 1023, 1122, 1222, 1320}, // 1900 115 | {0, 219, 320, 419, 518, 616, 716, 814, 913, 1012, 1111, 1211, 1310}, // 1901 116 | {0, 208, 310, 408, 508, 606, 705, 804, 902, 1002, 1031, 1130, 1230}, // 1902 117 | {5, 129, 227, 329, 427, 527, 625, 724, 823, 921, 1020, 1119, 1219, 1317}, // 1903 118 | {0, 216, 317, 416, 515, 614, 713, 811, 910, 1009, 1107, 1207, 1306}, // 1904 119 | {0, 204, 306, 405, 504, 603, 703, 801, 830, 929, 1028, 1127, 1226}, // 1905 120 | {4, 125, 223, 325, 424, 523, 622, 721, 820, 918, 1018, 1116, 1216, 1314}, // 1906 121 | {0, 213, 314, 413, 512, 611, 710, 809, 908, 1007, 1106, 1205, 1304}, // 1907 122 | {0, 202, 303, 401, 430, 530, 629, 728, 827, 925, 1025, 1124, 1223}, // 1908 123 | {2, 122, 220, 322, 420, 519, 618, 717, 816, 914, 1014, 1113, 1213, 1311}, // 1909 124 | {0, 210, 311, 410, 509, 607, 707, 805, 904, 1003, 1102, 1202, 1301}, // 1910 125 | {6, 130, 301, 330, 429, 528, 626, 726, 824, 922, 1022, 1121, 1220, 1319}, // 1911 126 | {0, 218, 319, 417, 517, 615, 714, 813, 911, 1010, 1109, 1209, 1307}, // 1912 127 | {0, 206, 308, 407, 506, 605, 704, 802, 901, 930, 1029, 1128, 1227}, // 1913 128 | {5, 126, 225, 327, 425, 525, 623, 723, 821, 920, 1019, 1117, 1217, 1315}, // 1914 129 | {0, 214, 316, 414, 514, 613, 712, 811, 909, 1009, 1107, 1207, 1305}, // 1915 130 | {0, 203, 304, 403, 502, 601, 630, 730, 829, 927, 1027, 1125, 1225}, // 1916 131 | {2, 123, 222, 323, 421, 521, 619, 719, 818, 916, 1016, 1115, 1214, 1313}, // 1917 132 | {0, 211, 313, 411, 510, 609, 708, 807, 905, 1005, 1104, 1203, 1302}, // 1918 133 | {7, 201, 302, 401, 430, 529, 628, 727, 825, 924, 1024, 1122, 1222, 1321}, // 1919 134 | {0, 220, 320, 419, 518, 616, 716, 814, 912, 1012, 1110, 1210, 1309}, // 1920 135 | {0, 208, 310, 408, 508, 606, 705, 804, 902, 1001, 1031, 1129, 1229}, // 1921 136 | {5, 128, 227, 328, 427, 527, 625, 724, 823, 921, 1020, 1119, 1218, 1317}, // 1922 137 | {0, 216, 317, 416, 516, 614, 714, 812, 911, 1010, 1108, 1208, 1306}, // 1923 138 | {0, 205, 305, 404, 504, 602, 702, 801, 830, 929, 1028, 1127, 1226}, // 1924 139 | {4, 124, 223, 324, 423, 522, 621, 721, 819, 918, 1018, 1116, 1216, 1314}, // 1925 140 | {0, 213, 314, 412, 512, 610, 710, 808, 907, 1007, 1105, 1205, 1304}, // 1926 141 | {0, 202, 304, 402, 501, 531, 629, 729, 827, 926, 1025, 1124, 1224}, // 1927 142 | {2, 123, 221, 322, 420, 519, 618, 717, 815, 914, 1013, 1112, 1212, 1311}, // 1928 143 | {0, 210, 311, 410, 509, 607, 707, 805, 903, 1003, 1101, 1201, 1231}, // 1929 144 | {6, 130, 228, 330, 429, 528, 626, 726, 824, 922, 1022, 1120, 1220, 1319}, // 1930 145 | {0, 217, 319, 418, 517, 616, 715, 814, 912, 1011, 1110, 1209, 1308}, // 1931 146 | {0, 206, 307, 406, 506, 604, 704, 802, 901, 930, 1029, 1128, 1227}, // 1932 147 | {5, 126, 224, 326, 425, 524, 623, 723, 821, 920, 1019, 1118, 1217, 1315}, // 1933 148 | {0, 214, 315, 414, 513, 612, 712, 810, 909, 1008, 1107, 1207, 1305}, // 1934 149 | {0, 204, 305, 403, 503, 601, 701, 730, 829, 928, 1027, 1126, 1226}, // 1935 150 | {3, 124, 223, 323, 421, 521, 619, 718, 817, 916, 1015, 1114, 1214, 1313}, // 1936 151 | {0, 211, 313, 411, 510, 609, 708, 806, 905, 1004, 1103, 1203, 1302}, // 1937 152 | {7, 131, 302, 401, 430, 529, 628, 727, 825, 924, 1023, 1122, 1222, 1320}, // 1938 153 | {0, 219, 321, 420, 519, 617, 717, 815, 913, 1013, 1111, 1211, 1309}, // 1939 154 | {0, 208, 309, 408, 507, 606, 705, 804, 902, 1001, 1031, 1129, 1229}, // 1940 155 | {6, 127, 226, 328, 426, 526, 625, 724, 823, 921, 1020, 1119, 1218, 1317}, // 1941 156 | {0, 215, 317, 415, 515, 614, 713, 812, 910, 1010, 1108, 1208, 1306}, // 1942 157 | {0, 205, 306, 405, 504, 603, 702, 801, 831, 929, 1029, 1127, 1227}, // 1943 158 | {4, 125, 224, 324, 423, 522, 621, 720, 819, 917, 1017, 1116, 1215, 1314}, // 1944 159 | {0, 213, 314, 412, 512, 610, 709, 808, 906, 1006, 1105, 1205, 1303}, // 1945 160 | {0, 202, 304, 402, 501, 531, 629, 728, 827, 925, 1025, 1124, 1223}, // 1946 161 | {2, 122, 221, 323, 421, 520, 619, 718, 816, 915, 1014, 1113, 1212, 1311}, // 1947 162 | {0, 210, 311, 409, 509, 607, 707, 805, 903, 1003, 1101, 1201, 1230}, // 1948 163 | {7, 129, 228, 329, 428, 528, 626, 726, 824, 922, 1022, 1120, 1220, 1318}, // 1949 164 | {0, 217, 318, 417, 517, 615, 715, 814, 912, 1011, 1110, 1209, 1308}, // 1950 165 | {0, 206, 308, 406, 506, 605, 704, 803, 901, 1001, 1030, 1129, 1228}, // 1951 166 | {5, 127, 225, 326, 424, 524, 622, 722, 820, 919, 1019, 1117, 1217, 1315}, // 1952 167 | {0, 214, 315, 414, 513, 611, 711, 810, 908, 1008, 1107, 1206, 1305}, // 1953 168 | {0, 203, 305, 403, 503, 601, 630, 730, 828, 927, 1027, 1125, 1225}, // 1954 169 | {3, 124, 222, 324, 422, 522, 620, 719, 818, 916, 1016, 1114, 1214, 1313}, // 1955 170 | {0, 212, 312, 411, 510, 609, 708, 806, 905, 1004, 1103, 1202, 1301}, // 1956 171 | {8, 131, 302, 331, 430, 529, 628, 727, 825, 924, 1023, 1122, 1221, 1320}, // 1957 172 | {0, 218, 320, 419, 519, 617, 717, 815, 913, 1013, 1111, 1211, 1309}, // 1958 173 | {0, 208, 309, 408, 508, 606, 706, 804, 903, 1002, 1101, 1130, 1230}, // 1959 174 | {6, 128, 227, 327, 426, 525, 624, 724, 822, 921, 1020, 1119, 1218, 1317}, // 1960 175 | {0, 215, 317, 415, 515, 613, 713, 811, 910, 1010, 1108, 1208, 1306}, // 1961 176 | {0, 205, 306, 405, 504, 602, 702, 731, 830, 929, 1028, 1127, 1227}, // 1962 177 | {4, 125, 224, 325, 424, 523, 621, 721, 819, 918, 1017, 1116, 1216, 1315}, // 1963 178 | {0, 213, 314, 412, 512, 610, 709, 808, 906, 1006, 1104, 1204, 1303}, // 1964 179 | {0, 202, 303, 402, 501, 531, 629, 728, 827, 925, 1024, 1123, 1223}, // 1965 180 | {3, 121, 220, 322, 421, 520, 619, 718, 816, 915, 1014, 1112, 1212, 1311}, // 1966 181 | {0, 209, 311, 410, 509, 608, 708, 806, 904, 1004, 1102, 1202, 1231}, // 1967 182 | {7, 130, 228, 329, 427, 527, 626, 725, 824, 922, 1022, 1120, 1220, 1318}, // 1968 183 | {0, 217, 318, 417, 516, 615, 714, 813, 912, 1011, 1110, 1209, 1308}, // 1969 184 | {0, 206, 308, 406, 505, 604, 703, 802, 901, 930, 1030, 1129, 1228}, // 1970 185 | {5, 127, 225, 327, 425, 524, 623, 722, 821, 919, 1019, 1118, 1218, 1316}, // 1971 186 | {0, 215, 315, 414, 513, 611, 711, 809, 908, 1007, 1106, 1206, 1304}, // 1972 187 | {0, 203, 305, 403, 503, 601, 630, 730, 828, 926, 1026, 1125, 1224}, // 1973 188 | {4, 123, 222, 324, 422, 522, 620, 719, 818, 916, 1015, 1114, 1214, 1312}, // 1974 189 | {0, 211, 313, 412, 511, 610, 709, 807, 906, 1005, 1103, 1203, 1301}, // 1975 190 | {8, 131, 301, 331, 429, 529, 627, 727, 825, 924, 1023, 1121, 1221, 1319}, // 1976 191 | {0, 218, 320, 418, 518, 617, 716, 815, 913, 1013, 1111, 1211, 1309}, // 1977 192 | {0, 207, 309, 407, 507, 606, 705, 804, 903, 1002, 1101, 1130, 1230}, // 1978 193 | {6, 128, 227, 328, 426, 526, 624, 724, 823, 921, 1021, 1120, 1219, 1318}, // 1979 194 | {0, 216, 317, 415, 514, 613, 712, 811, 909, 1009, 1108, 1207, 1306}, // 1980 195 | {0, 205, 306, 405, 504, 602, 702, 731, 829, 928, 1028, 1126, 1226}, // 1981 196 | {4, 125, 224, 325, 424, 523, 621, 721, 819, 917, 1017, 1115, 1215, 1314}, // 1982 197 | {0, 213, 315, 413, 513, 611, 710, 809, 907, 1006, 1105, 1204, 1303}, // 1983 198 | {10, 202, 303, 401, 501, 531, 629, 728, 827, 925, 1024, 1123, 1222, 1321}, // 1984 199 | {0, 220, 321, 420, 520, 618, 718, 816, 915, 1014, 1112, 1212, 1310}, // 1985 200 | {0, 209, 310, 409, 509, 607, 707, 806, 904, 1004, 1102, 1202, 1231}, // 1986 201 | {6, 129, 228, 329, 428, 527, 626, 726, 824, 923, 1023, 1121, 1221, 1319}, // 1987 202 | {0, 217, 318, 416, 516, 614, 714, 812, 911, 1011, 1109, 1209, 1308}, // 1988 203 | {0, 206, 308, 406, 505, 604, 703, 802, 831, 930, 1029, 1128, 1228}, // 1989 204 | {5, 127, 225, 327, 425, 524, 623, 722, 820, 919, 1018, 1117, 1217, 1316}, // 1990 205 | {0, 215, 316, 415, 514, 612, 712, 810, 908, 1008, 1106, 1206, 1305}, // 1991 206 | {0, 204, 304, 403, 503, 601, 630, 730, 828, 926, 1026, 1124, 1224}, // 1992 207 | {3, 123, 221, 323, 422, 521, 620, 719, 818, 916, 1015, 1114, 1213, 1312}, // 1993 208 | {0, 210, 312, 411, 511, 609, 709, 807, 906, 1005, 1103, 1203, 1301}, // 1994 209 | {8, 131, 301, 331, 430, 529, 628, 727, 826, 925, 1024, 1122, 1222, 1320}, // 1995 210 | {0, 219, 319, 418, 517, 616, 716, 814, 913, 1012, 1111, 1211, 1309}, // 1996 211 | {0, 207, 309, 407, 507, 605, 705, 803, 902, 1002, 1031, 1130, 1230}, // 1997 212 | {5, 128, 227, 328, 426, 526, 624, 723, 822, 921, 1020, 1119, 1219, 1317}, // 1998 213 | {0, 216, 318, 416, 515, 614, 713, 811, 910, 1009, 1108, 1208, 1307}, // 1999 214 | {0, 205, 306, 405, 504, 602, 702, 731, 829, 928, 1027, 1126, 1226}, // 2000 215 | {4, 124, 223, 325, 423, 523, 621, 721, 819, 917, 1017, 1115, 1215, 1313}, // 2001 216 | {0, 212, 314, 413, 512, 611, 710, 809, 907, 1006, 1105, 1204, 1303}, // 2002 217 | {0, 201, 303, 402, 501, 531, 630, 729, 828, 926, 1025, 1124, 1223}, // 2003 218 | {2, 122, 220, 321, 419, 519, 618, 717, 816, 914, 1014, 1112, 1212, 1310}, // 2004 219 | {0, 209, 310, 409, 508, 607, 706, 805, 904, 1003, 1102, 1201, 1231}, // 2005 220 | {7, 129, 228, 329, 428, 527, 626, 725, 824, 922, 1022, 1121, 1220, 1319}, // 2006 221 | {0, 218, 319, 417, 517, 615, 714, 813, 911, 1011, 1110, 1210, 1308}, // 2007 222 | {0, 207, 308, 406, 505, 604, 703, 801, 831, 929, 1029, 1128, 1227}, // 2008 223 | {5, 126, 225, 327, 425, 524, 623, 722, 820, 919, 1018, 1117, 1216, 1315}, // 2009 224 | {0, 214, 316, 414, 514, 612, 712, 810, 908, 1008, 1106, 1206, 1304}, // 2010 225 | {0, 203, 305, 403, 503, 602, 701, 731, 829, 927, 1027, 1125, 1225}, // 2011 226 | {4, 123, 222, 322, 421, 521, 619, 719, 817, 916, 1015, 1114, 1213, 1312}, // 2012 227 | {0, 210, 312, 410, 510, 608, 708, 807, 905, 1005, 1103, 1203, 1301}, // 2013 228 | {9, 131, 301, 331, 429, 529, 627, 727, 825, 924, 1024, 1122, 1222, 1320}, // 2014 229 | {0, 219, 320, 419, 518, 616, 716, 814, 913, 1013, 1112, 1211, 1310}, // 2015 230 | {0, 208, 309, 407, 507, 605, 704, 803, 901, 1001, 1031, 1129, 1229}, // 2016 231 | {6, 128, 226, 328, 426, 526, 624, 723, 822, 920, 1020, 1118, 1218, 1317}, // 2017 232 | {0, 216, 317, 416, 515, 614, 713, 811, 910, 1009, 1108, 1207, 1306}, // 2018 233 | {0, 205, 307, 405, 505, 603, 703, 801, 830, 929, 1028, 1126, 1226}, // 2019 234 | {4, 125, 223, 324, 423, 523, 621, 721, 819, 917, 1017, 1115, 1215, 1313}, // 2020 235 | {0, 212, 313, 412, 512, 610, 710, 808, 907, 1006, 1105, 1204, 1303}, // 2021 236 | {0, 201, 303, 401, 501, 530, 629, 729, 827, 926, 1025, 1124, 1223}, // 2022 237 | {2, 122, 220, 322, 420, 519, 618, 718, 816, 915, 1015, 1113, 1213, 1311}, // 2023 238 | {0, 210, 310, 409, 508, 606, 706, 804, 903, 1003, 1101, 1201, 1231}, // 2024 239 | {6, 129, 228, 329, 428, 527, 625, 725, 823, 922, 1021, 1120, 1220, 1319}, // 2025 240 | {0, 217, 319, 417, 517, 615, 714, 813, 911, 1010, 1109, 1209, 1308}, // 2026 241 | {0, 206, 308, 407, 506, 605, 704, 802, 901, 930, 1029, 1128, 1228}, // 2027 242 | {5, 126, 225, 326, 425, 524, 623, 722, 820, 919, 1018, 1116, 1216, 1315}, // 2028 243 | {0, 213, 315, 414, 513, 612, 711, 810, 908, 1008, 1106, 1205, 1304}, // 2029 244 | {0, 203, 304, 403, 502, 601, 701, 730, 829, 927, 1027, 1125, 1225}, // 2030 245 | {3, 123, 221, 323, 422, 521, 620, 719, 818, 917, 1016, 1115, 1214, 1313}, // 2031 246 | {0, 211, 312, 410, 509, 608, 707, 806, 905, 1004, 1103, 1203, 1301}, // 2032 247 | {11, 131, 301, 331, 429, 528, 627, 726, 825, 923, 1023, 1122, 1222, 1320}, // 2033 248 | {0, 219, 320, 419, 518, 616, 716, 814, 913, 1012, 1111, 1211, 1309}, // 2034 249 | {0, 208, 310, 408, 508, 606, 705, 804, 902, 1001, 1031, 1130, 1229}, // 2035 250 | {6, 128, 227, 328, 426, 526, 624, 723, 822, 920, 1019, 1118, 1217, 1316}, // 2036 251 | {0, 215, 317, 416, 515, 614, 713, 811, 910, 1009, 1107, 1207, 1305}, // 2037 252 | {0, 204, 306, 405, 504, 603, 702, 801, 830, 929, 1028, 1126, 1226}, // 2038 253 | {5, 124, 223, 325, 423, 523, 622, 721, 820, 918, 1018, 1116, 1216, 1314}, // 2039 254 | {0, 212, 313, 411, 511, 610, 709, 808, 906, 1006, 1105, 1204, 1303}, // 2040 255 | {0, 201, 302, 401, 430, 530, 628, 728, 827, 925, 1025, 1124, 1223}, // 2041 256 | {2, 122, 220, 322, 420, 519, 618, 717, 816, 914, 1014, 1113, 1212, 1311}, // 2042 257 | {0, 210, 311, 410, 509, 607, 707, 805, 903, 1003, 1102, 1201, 1231}, // 2043 258 | {7, 130, 229, 329, 428, 527, 625, 725, 823, 921, 1021, 1119, 1219, 1318}, // 2044 259 | {0, 217, 319, 417, 517, 615, 714, 813, 911, 1010, 1109, 1208, 1307}, // 2045 260 | {0, 206, 308, 406, 506, 604, 704, 802, 901, 930, 1029, 1128, 1227}, // 2046 261 | {5, 126, 225, 326, 425, 525, 623, 723, 821, 920, 1019, 1117, 1217, 1315}, // 2047 262 | {0, 214, 314, 413, 513, 611, 711, 810, 908, 1008, 1106, 1205, 1304}, // 2048 263 | {0, 202, 304, 402, 502, 531, 630, 730, 828, 927, 1027, 1125, 1225}, // 2049 264 | {3, 123, 221, 323, 421, 521, 619, 719, 817, 916, 1016, 1114, 1214, 1313}, // 2050 265 | {0, 211, 313, 411, 510, 609, 708, 806, 905, 1005, 1103, 1203, 1302}, // 2051 266 | {8, 201, 301, 331, 429, 528, 627, 726, 824, 923, 1022, 1121, 1221, 1320}, // 2052 267 | {0, 219, 320, 419, 518, 616, 716, 814, 912, 1012, 1110, 1210, 1309}, // 2053 268 | {0, 208, 309, 408, 508, 606, 705, 804, 902, 1001, 1031, 1129, 1229}, // 2054 269 | {6, 128, 226, 328, 427, 526, 625, 724, 823, 921, 1020, 1119, 1218, 1317}, // 2055 270 | {0, 215, 316, 415, 515, 613, 713, 811, 910, 1009, 1107, 1207, 1305}, // 2056 271 | {0, 204, 305, 404, 504, 602, 702, 731, 830, 928, 1028, 1126, 1226}, // 2057 272 | {4, 124, 223, 324, 423, 522, 621, 720, 819, 918, 1017, 1116, 1216, 1314}, // 2058 273 | {0, 212, 314, 412, 512, 610, 710, 808, 907, 1006, 1105, 1205, 1304}, // 2059 274 | {0, 202, 303, 401, 430, 530, 628, 727, 826, 924, 1024, 1123, 1223}, // 2060 275 | {3, 121, 220, 322, 420, 519, 618, 717, 815, 914, 1013, 1112, 1212, 1311}, // 2061 276 | {0, 209, 311, 410, 509, 607, 707, 805, 903, 1003, 1101, 1201, 1231}, // 2062 277 | {7, 129, 228, 330, 428, 528, 626, 726, 824, 922, 1022, 1120, 1220, 1318}, // 2063 278 | {0, 217, 318, 417, 516, 615, 714, 813, 911, 1010, 1109, 1208, 1307}, // 2064 279 | {0, 205, 307, 406, 505, 604, 704, 802, 901, 930, 1029, 1128, 1227}, // 2065 280 | {5, 126, 224, 326, 424, 524, 623, 722, 821, 919, 1019, 1117, 1217, 1315}, // 2066 281 | {0, 214, 315, 414, 513, 612, 711, 810, 909, 1008, 1107, 1206, 1305}, // 2067 282 | {0, 203, 304, 402, 502, 531, 629, 729, 828, 926, 1026, 1125, 1224}, // 2068 283 | {4, 123, 221, 323, 421, 521, 619, 718, 817, 915, 1015, 1114, 1214, 1312}, // 2069 284 | {0, 211, 312, 411, 510, 609, 708, 806, 905, 1004, 1103, 1203, 1301}, // 2070 285 | {8, 131, 302, 331, 430, 529, 628, 727, 825, 924, 1023, 1122, 1221, 1320}, // 2071 286 | {0, 219, 320, 418, 518, 616, 716, 814, 912, 1012, 1110, 1210, 1308}, // 2072 287 | {0, 207, 309, 407, 507, 606, 705, 804, 902, 1001, 1031, 1129, 1229}, // 2073 288 | {6, 127, 226, 327, 426, 526, 624, 724, 822, 921, 1020, 1119, 1218, 1317}, // 2074 289 | {0, 215, 317, 415, 515, 613, 713, 812, 910, 1010, 1108, 1208, 1306}, // 2075 290 | {0, 205, 305, 404, 503, 602, 701, 731, 829, 928, 1028, 1126, 1226}, // 2076 291 | {4, 124, 223, 324, 423, 522, 620, 720, 818, 917, 1017, 1116, 1215, 1314}, // 2077 292 | {0, 212, 314, 412, 512, 610, 709, 808, 906, 1006, 1105, 1204, 1303}, // 2078 293 | {0, 202, 303, 402, 501, 531, 629, 728, 827, 925, 1025, 1123, 1223}, // 2079 294 | {3, 122, 221, 321, 420, 519, 618, 717, 815, 914, 1013, 1111, 1211, 1310}, // 2080 295 | {0, 209, 310, 409, 509, 607, 707, 805, 903, 1003, 1101, 1130, 1230}, // 2081 296 | {7, 129, 227, 329, 428, 528, 626, 725, 824, 922, 1022, 1120, 1219, 1318}, // 2082 297 | {0, 217, 318, 417, 517, 615, 715, 813, 912, 1011, 1110, 1209, 1308}, // 2083 298 | {0, 206, 307, 405, 505, 603, 703, 802, 831, 930, 1029, 1128, 1227}, // 2084 299 | {5, 126, 224, 326, 424, 523, 622, 722, 820, 919, 1019, 1117, 1217, 1315}, // 2085 300 | {0, 214, 315, 414, 513, 611, 711, 809, 908, 1008, 1106, 1206, 1305}, // 2086 301 | {0, 203, 305, 403, 503, 601, 630, 730, 828, 927, 1026, 1125, 1225}, // 2087 302 | {4, 124, 222, 323, 421, 521, 619, 718, 817, 915, 1014, 1113, 1213, 1312}, // 2088 303 | {0, 210, 312, 411, 510, 609, 708, 806, 904, 1004, 1102, 1202, 1301}, // 2089 304 | {8, 130, 301, 331, 430, 529, 628, 727, 825, 924, 1023, 1121, 1221, 1320}, // 2090 305 | {0, 218, 320, 419, 518, 617, 716, 815, 913, 1013, 1111, 1210, 1309}, // 2091 306 | {0, 207, 308, 407, 506, 605, 705, 803, 902, 1001, 1031, 1129, 1229}, // 2092 307 | {6, 127, 225, 327, 426, 525, 624, 723, 822, 921, 1020, 1119, 1218, 1317}, // 2093 308 | {0, 215, 316, 415, 514, 613, 712, 811, 910, 1009, 1108, 1208, 1306}, // 2094 309 | {0, 205, 306, 405, 504, 602, 702, 731, 830, 928, 1028, 1127, 1227}, // 2095 310 | {4, 125, 224, 324, 423, 522, 620, 720, 818, 916, 1016, 1115, 1215, 1313}, // 2096 311 | {0, 212, 314, 412, 512, 610, 709, 807, 906, 1005, 1104, 1204, 1302}, // 2097 312 | {0, 201, 303, 402, 501, 531, 629, 728, 826, 925, 1024, 1123, 1222}, // 2098 313 | {2, 121, 220, 322, 420, 520, 619, 718, 816, 915, 1014, 1112, 1212, 1310}, // 2099 314 | {0, 209, 311, 410, 509, 608, 707, 806, 904, 1004, 1102, 1201, 1231}, // 2010 315 | {7, 129, 228, 330, 428, 528, 626, 726, 825, 923, 1023, 1121, 1220, 1319}, //2101 316 | {0, 217, 319, 417, 517, 616, 715, 814, 912, 1012, 1111, 1210, 1309}, //2102 317 | {0, 207, 308, 407, 506, 605, 704, 803, 901, 1001, 1031, 1130, 1229}, //2103 318 | {5, 128, 226, 327, 425, 524, 623, 722, 821, 919, 1019, 1118, 1217, 1316}, //2104 319 | {0, 215, 316, 415, 514, 612, 712, 810, 908, 1008, 1107, 1206, 1305}, //2105 320 | {0, 204, 306, 404, 504, 602, 701, 731, 829, 927, 1027, 1125, 1225}, //2106 321 | {4, 124, 223, 325, 423, 523, 621, 720, 819, 917, 1016, 1115, 1214, 1313}, //2107 322 | {0, 212, 313, 411, 511, 609, 709, 807, 906, 1005, 1103, 1203, 1301}, //2108 323 | {9, 131, 302, 331, 430, 530, 628, 728, 826, 925, 1024, 1122, 1222, 1320}, //2109 324 | {0, 219, 320, 419, 519, 617, 717, 816, 914, 1014, 1112, 1211, 1310}, //2110 325 | {0, 208, 310, 408, 508, 606, 706, 805, 903, 1003, 1101, 1201, 1231}, //2111 326 | {6, 129, 227, 328, 426, 526, 624, 724, 822, 921, 1021, 1119, 1219, 1318}, //2112 327 | {0, 216, 318, 416, 515, 614, 713, 811, 910, 1010, 1108, 1208, 1307}, //2113 328 | {0, 206, 307, 406, 505, 603, 703, 801, 830, 929, 1028, 1127, 1227}, //2114 329 | {4, 126, 225, 326, 425, 524, 622, 722, 820, 918, 1018, 1116, 1216, 1315}, //2115 330 | {0, 214, 314, 413, 512, 611, 710, 809, 907, 1006, 1105, 1204, 1303}, //2116 331 | {0, 202, 303, 402, 502, 531, 630, 729, 828, 926, 1025, 1124, 1223}, //2117 332 | {3, 122, 220, 322, 421, 520, 619, 719, 817, 916, 1015, 1113, 1213, 1311}, //2118 333 | {0, 210, 311, 410, 509, 608, 708, 806, 905, 1004, 1103, 1202, 1301}, //2119 334 | {7, 130, 229, 329, 428, 527, 626, 725, 824, 923, 1022, 1121, 1220, 1319}, //2120 335 | {0, 217, 319, 417, 517, 615, 715, 813, 912, 1011, 1110, 1210, 1309}, //2121 336 | {0, 207, 308, 407, 506, 605, 704, 802, 901, 930, 1030, 1129, 1229}, //2122 337 | {5, 127, 226, 328, 426, 525, 624, 723, 821, 920, 1019, 1118, 1218, 1317}, //2123 338 | {0, 215, 316, 414, 514, 612, 712, 810, 908, 1008, 1106, 1206, 1305}, //2124 339 | {0, 203, 305, 404, 503, 602, 701, 731, 829, 927, 1027, 1125, 1225}, //2125 340 | {4, 123, 222, 324, 423, 522, 621, 720, 819, 917, 1016, 1115, 1214, 1313}, //2126 341 | {0, 211, 313, 412, 511, 610, 710, 808, 906, 1006, 1104, 1204, 1302}, //2127 342 | {11, 201, 301, 331, 429, 529, 628, 727, 826, 924, 1024, 1122, 1222, 1320}, //2128 343 | {0, 219, 320, 419, 518, 617, 716, 815, 914, 1013, 1112, 1211, 1310}, //2129 344 | {0, 208, 310, 408, 508, 606, 705, 804, 903, 1002, 1101, 1201, 1230}, //2130 345 | {6, 129, 227, 329, 427, 527, 625, 724, 823, 921, 1021, 1120, 1220, 1318}, //2131 346 | {0, 217, 317, 416, 515, 614, 713, 811, 910, 1009, 1108, 1208, 1306}, //2132 347 | {0, 205, 307, 405, 505, 603, 703, 801, 830, 928, 1028, 1127, 1226}, //2133 348 | {5, 125, 224, 326, 424, 524, 622, 722, 820, 918, 1018, 1116, 1216, 1314}, //2134 349 | {0, 213, 315, 413, 513, 612, 711, 809, 908, 1007, 1106, 1205, 1304}, //2135 350 | {0, 202, 303, 401, 501, 531, 629, 729, 827, 926, 1025, 1124, 1223}, //2136 351 | {2, 122, 220, 322, 420, 520, 618, 718, 817, 915, 1015, 1113, 1213, 1311}, //2137 352 | {0, 210, 311, 410, 509, 608, 707, 806, 904, 1004, 1103, 1202, 1301}, //2138 353 | {7, 130, 301, 330, 429, 528, 626, 726, 824, 923, 1023, 1122, 1221, 1320}, //2139 354 | {0, 218, 319, 417, 517, 615, 714, 813, 911, 1011, 1110, 1209, 1308}, //2140 355 | {0, 207, 308, 407, 506, 605, 704, 802, 901, 930, 1030, 1128, 1228}, //2141 356 | {5, 127, 226, 327, 426, 525, 624, 723, 821, 919, 1019, 1117, 1217, 1316}, //2142 357 | {0, 215, 316, 415, 515, 613, 713, 811, 909, 1008, 1107, 1206, 1305}, //2143 358 | {0, 204, 304, 403, 503, 602, 701, 730, 829, 927, 1027, 1125, 1224}, //2144 359 | {4, 123, 222, 323, 422, 522, 620, 720, 818, 917, 1016, 1115, 1214, 1313}, //2145 360 | {0, 211, 312, 411, 511, 609, 709, 807, 906, 1006, 1104, 1204, 1302}, //2146 361 | {0, 201, 302, 331, 430, 529, 628, 728, 826, 925, 1025, 1123, 1223}, //2147 362 | {1, 121, 220, 320, 419, 518, 616, 716, 814, 913, 1013, 1111, 1211, 1310}, //2148 363 | {0, 208, 310, 408, 508, 606, 705, 804, 902, 1002, 1031, 1130, 1230}, //2149 364 | {6, 129, 227, 329, 427, 527, 625, 724, 822, 921, 1020, 1119, 1219, 1318}, //2150 365 | }; 366 | 367 | /** 368 | * 获取农历日的表示 369 | * 370 | * @param lunarDay  农历日数值表示 371 | * @return 农历日传统字符表示 372 | */ 373 | public static String getDayName(int lunarDay) { 374 | return LunarDayName[lunarDay - 1]; 375 | } 376 | 377 | /** 378 | * 获取农历月份 379 | * 380 | * @param lunarMonth  农历月数值表示 381 | * @return 农历月传统字符表示 382 | */ 383 | public static char getMonthName(int lunarMonth) { 384 | return LunarMonthName[lunarMonth - 1]; 385 | } 386 | 387 | /** 388 | * 获取农历年份 389 | * 390 | * @param lunarYear  农历年数值表示 391 | * @return 农历年传统字符表示 392 | */ 393 | public static String getYearName(int lunarYear) { 394 | StringBuilder sb = new StringBuilder(); 395 | sb.append(LunarYearName[lunarYear / 1000]); 396 | sb.append(LunarYearName[lunarYear % 1000 / 100]); 397 | sb.append(LunarYearName[lunarYear % 100 / 10]); 398 | sb.append(LunarYearName[lunarYear % 10]); 399 | return sb.toString(); 400 | } 401 | 402 | /** 403 | * 返回传统天干地支年名称 404 | * 405 | * @param y 农历年 406 | * @return 传统农历年份的表示 407 | */ 408 | public static String getTraditionalYearName(int y) { 409 | // 1804年是甲子年 410 | y = y - 1804; 411 | return ("" + LunarGan[y % 10] + LunarZhi[y % 12] + "年"); 412 | } 413 | 414 | /** 415 | * 获取生肖名 416 | * 417 | * @param y  农历年 418 | * @return 生肖名 419 | */ 420 | public static char getAnimalYearName(int y) { 421 | return LunarAnimalName[(y - 4) % 12]; 422 | } 423 | } 424 | --------------------------------------------------------------------------------