Chinese Lunar | algorithm | conversion ' Below is a lunar algorithm about VB
' Date data definition method is as follows
' The first 12 bytes represent January-December for Semi-rotary or the moon, 1 for semi-rotary 30 days, 0 for the Moon 29 days;
' The 13th place for the leap month situation, 1 for the Semi-rotary 30 days, 0 for the Yue 29 days;
' 14th is the month of the leap month, if not the leap month is 0, otherwise give months, 10, 11, 12 respectively with a, B, C to express, even with 16;
The last 4 are the dates of the Lunar New Year-the Gregorian calendar of the lunar January 1, such as 0131 for January 31.
Function getchgdate (ByVal vdate As String, ByVal Chgtype as conversion) As String
Dim vvdate () as String = Split (Vdate, "-")
If vvdate (0) > Or vvdate (0) < 1900 Then
Throw New NotSupportedException ("This function only provides calendar conversions from 1900 to 2011!") ")
End If
Dim Addmonth, Addday, Addyear, Getday, I as Integer
Dim Runyue as Boolean
Dim Condate as DateTime
Dim Dalist as String
Dalist (1900) = "010010110110180131"
Dalist (1901) = "010010101110000219"
Dalist (1902) = "101001010111000208"
Dalist (1903) = "010100100110150129"
Dalist (1904) = "110100100110000216"
Dalist (1905) = "110110010101000204"
Dalist (1906) = "011010101010140125"
Dalist (1907) = "010101101010000213"
Dalist (1908) = "100110101101000202"
Dalist (1909) = "010010101110120122"
Dalist (1910) = "010010101110000210"
Dalist (1911) = "101001001101160130"
Dalist (1912) = "101001001101000218"
Dalist (1913) = "110100100101000206"
Dalist (1914) = "110101010100150126"
Dalist (1915) = "101101010101000214"
Dalist (1916) = "010101101010000204"
Dalist (1917) = "100101101101020123"
Dalist (1918) = "100101011011000211"
Dalist (1919) = "010010011011170201"
Dalist (1920) = "010010011011000220"
Dalist (1921) = "101001001011000208"
Dalist (1922) = "101100100101150128"
Dalist (1923) = "011010100101000216"
Dalist (1924) = "011011010100000205"
Dalist (1925) = "101011011010140124"
Dalist (1926) = "001010110110000213"
Dalist (1927) = "100101010111000202"
Dalist (1928) = "010010010111120123"
Dalist (1929) = "010010010111000210"
Dalist (1930) = "011001001011060130"
Dalist (1931) = "110101001010000217"
Dalist (1932) = "111010100101000206"
Dalist (1933) = "011011010100150126"
Dalist (1934) = "010110101101000214"
Dalist (1935) = "001010110110000204"
Dalist (1936) = "100100110111030124"
Dalist (1937) = "100100101110000211"
Dalist (1938) = "110010010110170131"
Dalist (1939) = "110010010101000219"
Dalist (1940) = "110101001010000208"
Dalist (1941) = "110110100101060127"
Dalist (1942) = "101101010101000215"
Dalist (1943) = "010101101010000205"
Dalist (1944) = "101010101101140125"
Dalist (1945) = "001001011101000213"
Dalist (1946) = "100100101101000202"
Dalist (1947) = "110010010101120122"
Dalist (1948) = "101010010101000210"
Dalist (1949) = "101101001010170129"
Dalist (1950) = "011011001010000217"
Dalist (1951) = "101101010101000206"
Dalist (1952) = "010101011010150127"
Dalist (1953) = "010011011010000214"
Dalist (1954) = "101001011011000203"
Dalist (1955) = "010100101011130124"
Dalist (1956) = "010100101011000212"
Dalist (1957) = "101010010101080131"
Dalist (1958) = "111010010101000218"
Dalist (1959) = "011010101010000208"
Dalist (1960) = "101011010101060128"
Dalist (1961) = "101010110101000215"
Dalist (1962) = "010010110110000205"
Dalist (1963) = "101001010111040125"
Dalist (1964) = "101001010111000213"
Dalist (1965) = "010100100110000202"
Dalist (1966) = "111010010011030121"
Dalist (1967) = "110110010101000209"
Dalist (1968) = "010110101010170130"
Dalist (1969) = "010101101010000217"
Dalist (1970) = "100101101101000206"
Dalist (1971) = "010010101110150127"
Dalist (1972) = "010010101101000215"
Dalist (1973) = "101001001101000203"
Dalist (1974) = "110100100110140123"
Dalist (1975) = "110100100101000211"
Dalist (1976) = "110101010010180131"
Dalist (1977) = "101101010100000218"
Dalist (1978) = "101101101010000207"
Dalist (1979) = "100101101101060128"
Dalist (1980) = "100101011011000216"
Dalist (1981) = "010010011011000205"
Dalist (1982) = "101001001011140125"
Dalist (1983) = "101001001011000213"
Dalist (1984) = "1011001001011a0202"
Dalist (1985) = "011010100101000220"
Dalist (1986) = "011011010100000209"
Dalist (1987) = "101011011010060129"
Dalist (1988) = "101010110110000217"
Dalist (1989) = "100100110111000206"
Dalist (1990) = "010010010111150127"
Dalist (1991) = "010010010111000215"
Dalist (1992) = "011001001011000204"
Dalist (1993) = "011010100101030123"
Dalist (1994) = "111010100101000210"
Dalist (1995) = "011010110010180131"
Dalist (1996) = "010110101100000219"
Dalist (1997) = "101010110110000207"
Dalist (1998) = "100100110110150128"
Dalist (1999) = "100100101110000216"
Dalist (2000) = "110010010110000205"
Dalist (2001) = "110101001010140124"
Dalist (2002) = "110101001010000212"
Dalist (2003) = "110110100101000201"
Dalist (2004) = "010110101010120122"
Dalist (2005) = "010101101010000209"
Dalist (2006) = "101010101101170129"
Dalist (2007) = "001001011101000218"
Dalist (2008) = "100100101101000207"
Dalist (2009) = "110010010101150126"
Dalist (2010) = "101010010101000214"
Dalist (2011) = "101101001010000214"
Addyear = vvdate (0)
If Chgtype = conversion mode. Lunar Calendar Then
Addmonth = Val (Mid (Dalist (addyear), 15, 2))
Addday = Val (Mid (Dalist (addyear), 17, 2))
Condate = DateSerial (Addyear, Addmonth, Addday)
Addday = Vvdate (2)
For i = 1 to vvdate (1)-1
Addday = Addday + + Val (Mid (dalist (vvdate (0)), I, 1)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.