'The following is a lunar calendar algorithm for VB' date data definition method, the first 12 bytes represent from 1 to December for the day or Xiaoyue, 1 for the day of the month, 0 is 29 days, ' 13 is the month of the month, 1 is 30 days in the month, 0 is 29 days in Xiaoyue, and the 14th place is the month of the month. If it is not a month 0, otherwise give the month, 10, 11, 12, respectively , B, c commented on the table ', even if he is used. Final 4 is the date of the Chinese New Year, the Lunar New Year, the Lunar New Year, such as 0131 represents January 31. 'Getyldate function Usage If Tyear is the year to enter, TMONTH is the month, tday is' date, YlyEar is the return value, returns the year of the lunar calendar, such as the year, Ylshuxing returned' is an object, such as the rat. Isgetgl is the setting of the gauge value by the lunar calendar. If yes, 'the top three returns the corresponding question date, and the return value is a reply date.
Function GetYldate (Tyear As Integer, TMONTH AS INTEGER, TDAY AS INTEGER, _ YLYEAR AS STRING, YLSHUXING As String, _ Optional isgetgl as boolean) AS String
On Error Resume Next Dim daList (1900 To 2011) As String * 18 Dim conDate As Date, setDate As Date Dim AddMonth As Integer, AddDay As Integer, AddYear As Integer, getDay As Integer Dim RunYue As Boolean If tYear> 2010 Or tYear < 1901 Then exit Function 'if it is not effective with the date, exit' 1900 to 1909 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) = "0110101010100000205" Dalist (1925) = "101011011010140124" DALIST (1926) = "001010101110202" 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) = "010011011 010000214 "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) = "101011011 010060129 "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 = tYear RunYue = False If IsGetGl Then AddMonth = Val (Mid (daList (addYear), 15, 2) Addday = VAL (MID (Dalist (AdDyear), 17, 2))) Condte = DateSerial (Addyear, AddMonth, AddDay) AddDay = TDAY for i = 1 To TMONTH - 1 AddDay = AddDay 29 VAL (MID) Dalist (Tyear), I, 1)) Next I 'MSGBOX Datediff ("D", Conda TE, date) setdate = dateadd ("d", addday - 1, condate) getyldate = setdate type = year (setdate) TMONTH = month (setdate) TDAY = day (setdate) EXIT function end ifchushihua: addMonth = VAL (MID) Dalist (Addyear), 15, 2)) Addday = VAL (MID (Dalist (AddYear), 17, 2))) Condate = DateSerial (addyear, addmonth, adddty) setdate = dateserial (Tyear, TMONTH, TDAY) getday = datediff "d"
, condate, setdate) if getday <0 Then addyear = addyear - 1: goto chushihua 'adddty = NEARDAY AddDay = 1: addmonth = 1 for i = 1 to getday addday = addday 1 if addday = 30 MID (Dalist (addyear ), Addmonth, 1) or (Runyue and addday = 30 MID (Dalist (addyear), 13, 1)) Then if Runyue = false and addmonth = VAL ("& H" & MID (Dalist (AddYear), 14, 1 ))) = AddMonth 1 end if addday = 1 end if next md $ = "The first third day of the third first six first six first ninety eleventh Twenty-three forty fifty five seventy eight ninety-eight 廿 二 二 八 八 三 "DD $ = MID (MD $, (AddDay - 1 ) * 2 1, 2) mm $ = MID ("正 二三 三四", addmonth, 1) "Month" Yougetdate = DateSerial (AddYear, AddMonth, AddDay) Tiangan $ = " Methyl propylene has been Geng Xinzhi "Dizhi $ =" Ziqi Yuchen Niu Nou) Dim Ganzhi (0 to 59) AS String * 2 for i = 0 to 59 Ganzhi (i) = MID (Tiangan $, (i mod) 10) 1, 1) MID (Dizhi $, (i MOD 12) 1, 1) 'FF $ = ff $ G Anzhi (i) Next I 'msgbox ff $,, LEN (ff $) yilyear = Ganzhi (adyear - 4) MOD 60) SHU $ = "Mouse Niuhu Rabbit Dragon Snake Patty Chicken Chicken Pig" YLSHUXING = MID (SHU $, (Addyear - 4) MOD 12) 1, 1) if Runyue Then MM $ = "" mm $ getyldate = mm $ DD $ END FUNCTION