Add a lunar calendar support module in Access.

zhaozj2021-02-11  159

Add a lunar calendar support module in Access.

New module, copy the following two functions. Glgetnl (), Strnl ()

Used in the query: SELECT GLGETNL (BORN) AS NLBORN FROM Empolyee Where Glgetn> "05012" Order by Glgetnl (Born)

The above query returns a list of Lunar New Days than May 12th employee, and sorted by the lunar calendar.

(Disclaimer: These two functions are not written from zero, which modified the program code that I didn't know online. Go to Google Enter keyword VB Lunar calendar to find multiple references to this article

Originally, I wanted to call directly in the ASP, and later I thought in the database, but I can use in Access, using ADO in ASP. I can't call it in the ASP. I found the 1998 Lunar Calendar in the original data in the debugging. The monthly code is not the original code. The month, another revision of the counted algorithm. Nor to contact the original author, forgive me.)

'Enter Date, return "mmlddyyyyy" mm: month; l: 1, 月, 0, usual month; DD: day; YYYY year Function Glgetnl (Byval gldate) DIM Dalist (11)' 1900 to 1909 Dalist (0) = " 010010110110180131 "daList (1) =" 010010101110000219 "daList (2) =" 101001010111000208 "daList (3) =" 010100100110150129 "daList (4) =" 110100100110000216 "daList (5) =" 110110010101000204 "daList (6) =" 011010101010140125 " daList (7) = "010101101010000213" daList (8) = "100110101101000202" daList (9) = "010010101110120122" daList (10) = "010010101110000210" daList (11) = "101001001101160130" daList (12) = "101001001101000218" daList ( 13) = "110100100101000206" daList (14) = "110101010100150126" daList (15) = "101101010101000214" daList (16) = "010101101010000204" daList (17) = "100101101101020123" daList (18) = "100101011011000211" daList (19) = "010010011011170201" DALIST (20) = "010010011011000220" DALIST (21) = "101001001011000208" Dalist (22) = "101100100101150128" Dalist (23) = "01101010010 1000216 "daList (24) =" 011011010100000205 "daList (25) =" 101011011010140124 "daList (26) =" 001010110110000213 "daList (27) =" 100101010111000202 "daList (28) =" 010010010111120123 "daList (29) =" 010010010111000210 " Dalist (30) = "011001001011060130" DALIST (31) = "110101001010000217" DALIST (32) = "

111010100101000206 "daList (33) =" 011011010100150126 "daList (34) =" 010110101101000214 "daList (35) =" 001010110110000204 "daList (36) =" 100100110111030124 "daList (37) =" 100100101110000211 "daList (38) =" 110010010110170131 " daList (39) = "110010010101000219" daList (40) = "110101001010000208" daList (41) = "110110100101060127" daList (42) = "101101010101000215" daList (43) = "010101101010000205" daList (44) = "101010101101140125" daList ( 45) = "001001011101000213" daList (46) = "100100101101000202" daList (47) = "110010010101120122" daList (48) = "101010010101000210" daList (49) = "101101001010170129" daList (50) = "011011001010000217" daList (51) = "101101010101000206" daList (52) = "010101011010150127" daList (53) = "010011011010000214" daList (54) = "101001011011000203" daList (55) = "010100101011130124" daList (56) = "010100101011000212" daList (57) = " 101010010101080131 "Dalist (58) =" 111010010101000218 "DALIST (59) =" 0 11010101010000208 "daList (60) =" 101011010101060128 "daList (61) =" 101010110101000215 "daList (62) =" 010010110110000205 "daList (63) =" 101001010111040125 "daList (64) =" 101001010111000213 "daList (65) =" 010100100110000202 " Dalist (66) = "111010010011030121" DALIST (67) = "110110010101000209"

daList (68) = "010110101010170130" daList (69) = "010101101010000217" daList (70) = "100101101101000206" daList (71) = "010010101110150127" daList (72) = "010010101101000215" daList (73) = "101001001101000203" daList ( 74) = "110100100110140123" daList (75) = "110100100101000211" daList (76) = "110101010010180131" daList (77) = "101101010100000218" daList (78) = "101101101010000207" daList (79) = "100101101101060128" daList (80) = "100101011011000216" daList (81) = "010010011011000205" daList (82) = "101001001011140125" daList (83) = "101001001011000213" daList (84) = "1011001001011A0202" daList (85) = "011010100101000220" daList (86) = " 011011010100000209 "daList (87) =" 101011011010060129 "daList (88) =" 101010110110000217 "daList (89) =" 100100110111000206 "daList (90) =" 010010010111150127 "daList (91) =" 010010010111000215 "daList (92) =" 011001001011000204 " Dalist (93) = "011010100101030123" DALIST (94) = "111010100101000210" D aList (95) = "011010110010180131" daList (96) = "010110101100000219" daList (97) = "101010110110000207" daList (98) = "100100110110050128" daList (99) = "100100101110000216" daList (100) = "110010010110000205" daList ( 101) = "110101001010140124" DALIST (102) = "110101001010000212" DALIST (103) = "

110110100101000201 "daList (104) =" 010110101010120122 "daList (105) =" 010101101010000209 "daList (106) =" 101010101101170129 "daList (107) =" 001001011101000218 "daList (108) =" 100100101101000207 "daList (109) =" 110010010101150126 " daList (110) = "101010010101000214" daList (111) = "101101001010000214" On Error Resume Next Dim conDate As Date Dim tYear, AddMonth, addDay, addYear, getDay, i As Integer Dim RunYue As Boolean tYear = Year (gldate) If tYear > 2010 or Tyear <1901 Then Glgetnl = "" EXIT function "If it is not a valid date, exit end if runyue = false addyear = type = Tyear Do AddMonth = CINT (MID (Dalist (Dalist (AddDyear - 1900), 15, 2))))) AddDay = CINT (MID (Dalist (ADDYEAR - 1900), 17, 2)) Condate = DateSerial (addyear, addmonth, addday getday = datediff ("d", condate, gldate) if getday <0 dam = addyar - 1 loop while Getday <0 addday = 1 addmonth = 1 for i = 1 to getday addday = addday 1 if Addday = 30 CINT (MID (Dalist (ADDYEAR - 1900), Addmonth, 1)) or (Runyue and AddDay = 30 CINT (MID (Dalist (Dalist (AddYear - 1900), 13, 1))) The IF Runyue = false and addmonth = CINT ("& H" & MID (Dalist (AddYear - 1900), 14, 1)) THEN Runyue = true else runyue = false addMonth = addMonth 1 end if adddty = 1 end if Next Glgetnl = iif (Addmonth> 9, CSTR (AddMonth), "

0 " CSTR (AddMonth)) IIF (Runyue," 1 "," 0 ") IIF (AddDay> 9, CSTR (AddDay)," 0 " CSTR (AddDay)) cstr (addyear) End Function ' Enter SNL = "mmlddyyyyy" mm: month; l: 1, 月, 0, usual month; DD: day; YYYY year 'function returns "XX month XX", belongs to SSHUXINAG, Dry Support Year is deposited in Syear

Function Strnl (Byval Snl, Byref Sshuxiang, Byref Syear) DIM LNL_MD, LNL_CM, LNL_TIANGAN, LNL_DIZHI, LNL_SHU LNL_MD = "The first third first three first four first five seventh eighth eighth first ninety-one 120 Thirty forty fifty six seventy eight nine twenty martial arts five 廿 二 八 八 nine 30 "lnl_cm =" Zheng two three four five six seven eight ninety cold La "LNL_Tiangan =" Methyl propylene "LNL_DIZHI =" Ziqi Yuchen 巳 未 酉 亥 亥 "LNL_SHU =" Rat Niuhu Rabbit Dragon Snake Parm Monkey Chicken Pig "on Error ResMe next Dim Iy, IM, ID, Isleap im = CINT (Left (SNL, 2)) isleap = CINT (MID (SNL, 3, 1)) ID = CINT (MID (SNL, 4, 2)) IY = CINT (Right (SNL, 4)) Strnl = MID (LNL_CM, IM, 1) & "Month" & Mid (LNL_MD, (ID - 1) * 2 1, 2) if Isleap> 0 Then Strnl = "" & strnl IY = IY - 4 sshuxiang = MID (LNL_SHU, (IY MOD 12) 1, 1) SYEAR = MID (LNL_Tiangan, (IY MOD 10) 1, 1) & MID (LNL_Dizhi, (IY MOD 12) 1, 1) End Function

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

New Post(0)