In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces "how to write the VBS code to display the lunar calendar". In the daily operation, I believe many people have doubts about how to write the VBS code to display the lunar calendar. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "how to write the VBS code to display the lunar calendar". Next, please follow the editor to study!
The copy code is as follows:
Function nl ()
'get the current system time
CurTime = Now ()
Dim WeekName (7), MonthAdd (11), NongliData (99), TianGan (9), DiZhi (11), ShuXiang (11), DayName (30), MonName (12)
The name of the week
WeekName (0) = "*"
WeekName (1) = "Sunday"
WeekName (2) = "Monday"
WeekName (3) = "Tuesday"
WeekName (4) = "Wednesday"
WeekName (5) = "Thursday"
WeekName (6) = "Friday"
WeekName (7) = "Saturday"
'Tiangan name
TianGan (0) = "A"
TianGan (1) = "B"
TianGan (2) = "C"
TianGan (3) = "D"
TianGan (4) = "E"
TianGan (5) = "oneself"
TianGan (6) = "Geng"
TianGan (7) = "Xin"
TianGan (8) = "ren"
TianGan (9) = "Gui"
'The name of the local branch
DiZhi (0) = "Zi"
DiZhi (1) = "ugly"
DiZhi (2) = "Yin"
DiZhi (3) = "Mao"
DiZhi (4) = "Chen"
DiZhi (5) = "si"
DiZhi (6) = "noon"
DiZhi (7) = "not"
DiZhi (8) = "Shen"
DiZhi (9) = "Unitary"
DiZhi (10) = "Xu"
DiZhi (11) = "Hai"
'Genofacies name
ShuXiang (0) = "mouse"
ShuXiang (1) = "Niu"
ShuXiang (2) = "Tiger"
ShuXiang (3) = "Rabbit"
ShuXiang (4) = "Dragon"
ShuXiang (5) = "snake"
ShuXiang (6) = "horse"
ShuXiang (7) = "sheep"
ShuXiang (8) = "monkey"
ShuXiang (9) = "Chicken"
ShuXiang (10) = "dog"
ShuXiang (11) = "pig"
'lunar calendar date name
DayName (0) = "*"
DayName (1) = "Grade 8"
DayName (2) = "Grade 8"
DayName (3) = "Grade 8"
DayName (4) = "Grade 4"
DayName (5) = "Grade 5"
DayName (6) = "Grade 6"
DayName (7) = "Grade 7"
DayName (8) = "eighth day"
DayName (9) = "the ninth day"
DayName (10) = "the tenth day of junior high school"
DayName (11) = "National Day"
DayName (12) = "twelve"
DayName (13) = "thirteen"
DayName (14) = "14"
DayName (15) = "15"
DayName (16) = "sixteen"
DayName (17) = "seventeen"
DayName (18) = "eighteen"
DayName (19) = "nineteen"
DayName (20) = "20"
DayName (21) = "21"
DayName (22) = "22"
DayName (23) = "23"
DayName (24) = "24"
DayName (25) = "25"
DayName (26) = "26"
DayName (27) = "27"
DayName (28) = "28"
DayName (29) = "29"
DayName (30) = "30"
'lunar month name
MonName (0) = "*"
MonName (1) = "positive"
MonName (2) = "two"
MonName (3) = "three"
MonName (4) = "four"
MonName (5) = "five"
MonName (6) = "six"
MonName (7) = "seven"
MonName (8) = "eight"
MonName (9) = "nine"
MonName (10) = "ten"
MonName (11) = "National Day"
MonName (12) = "wax"
'The number of days before each month in the Gregorian calendar
MonthAdd (0) = 0
MonthAdd (1) = 31
MonthAdd (2) = 59
MonthAdd (3) = 90
MonthAdd (4) = 120
MonthAdd (5) = 151,
MonthAdd (6) = 181,
MonthAdd (7) = 212
MonthAdd (8) = 243,
MonthAdd (9) = 273
MonthAdd (10) = 304
MonthAdd (11) = 334
'Lunar calendar data
NongliData (0) = 2635
NongliData (1) = 333387
NongliData (2) = 1701
NongliData (3) = 1748
NongliData (4) = 267701
NongliData (5) = 694
NongliData (6) = 2391
NongliData (7) = 133423
NongliData (8) = 1175
NongliData (9) = 396438
NongliData (10) = 3402
NongliData (11) = 3749
NongliData (12) = 331177
NongliData (13) = 1453
NongliData (14) = 694
NongliData (15) = 201326
NongliData (16) = 2350
NongliData (17) = 465197
NongliData (18) = 3221
NongliData (19) = 3402
NongliData (20) = 400202
NongliData (21) = 2901
NongliData (22) = 1386
NongliData (23) = 267611
NongliData (24) = 605
NongliData (25) = 2349
NongliData (26) = 137515
NongliData (27) = 2709
NongliData (28) = 464533
NongliData (29) = 1738
NongliData (30) = 2901
NongliData (31) = 330421
NongliData (32) = 1242
NongliData (33) = 2651
NongliData (34) = 199255
NongliData (35) = 1323
NongliData (36) = 529706
NongliData (37) = 3733
NongliData (38) = 1706
NongliData (39) = 398762
NongliData (40) = 2741
NongliData (41) = 1206
NongliData (42) = 267438
NongliData (43) = 2647
NongliData (44) = 1318
NongliData (45) = 204070
NongliData (46) = 3477
NongliData (47) = 461653
NongliData (48) = 1386
NongliData (49) = 2413
NongliData (50) = 330077
NongliData (51) = 1197
NongliData (52) = 2637
NongliData (53) = 268877
NongliData (54) = 3365
NongliData (55) = 531109
NongliData (56) = 2900
NongliData (57) = 2922
NongliData (58) = 398042
NongliData (59) = 2395
NongliData (60) = 1179
NongliData (61) = 267415
NongliData (62) = 2635
NongliData (63) = 661067
NongliData (64) = 1701
NongliData (65) = 1748
NongliData (66) = 398772
NongliData (67) = 2742
NongliData (68) = 2391
NongliData (69) = 330031
NongliData (70) = 1175
NongliData (71) = 1611
NongliData (72) = 200010
NongliData (73) = 3749
NongliData (74) = 527717
NongliData (75) = 1452
NongliData (76) = 2742
NongliData (77) = 332397
NongliData (78) = 2350
NongliData (79) = 3222
NongliData (80) = 268949
NongliData (81) = 3402
NongliData (82) = 3493
NongliData (83) = 133973
NongliData (84) = 1386
NongliData (85) = 464219
NongliData (86) = 605
NongliData (87) = 2349
NongliData (88) = 334123
NongliData (89) = 2709
NongliData (90) = 2890
NongliData (91) = 267946
NongliData (92) = 2773
NongliData (93) = 592565
NongliData (94) = 1210
NongliData (95) = 2651
NongliData (96) = 395863
NongliData (97) = 1323
NongliData (98) = 2707
NongliData (99) = 265877
'generate the current calendar year, month and day = = > GongliStr
CurYear = Year (curTime)
CurMonth = Month (curTime)
CurDay = Day (curTime)
GongliStr = curYear & "year"
If (curMonth
< 10) Then GongliStr = GongliStr & "0" & curMonth & "月" Else GongliStr = GongliStr & curMonth & "月" End If If (curDay < 10) Then GongliStr = GongliStr & "0" & curDay & "日" Else GongliStr = GongliStr & curDay & "日" End If '生成当前公历星期 ==>WeekdayStr
CurWeekday = Weekday (curTime)
WeekdayStr = WeekName (curWeekday)
'The number of days calculated to the initial time of February 8, 1921: 1921-2-8 (the first day of the first lunar month)
TheDate = (curYear-1921) * 365 + Int ((curYear-1921) / 4) + curDay + MonthAdd (curMonth-1)-38
If ((curYear Mod 4) = 0 And curMonth > 2) Then
TheDate = TheDate + 1
End If
'calculate the celestial stem, earth branch, month and day of the lunar calendar
IsEnd = 0
M = 0
Do
If (NongliData (m)
< 4095) Then k = 11 Else k = 12 End If n = k Do If (n < 0) Then Exit Do End If '获取NongliData(m)的第n个二进制位的值 bit = NongliData(m) For i = 1 To n Step 1 bit = Int(bit / 2) Next bit = bit Mod 2 If (TheDate (Int(NongliData(m) / 65536) + 1)) Then curMonth = curMonth - 1 End If End If '生成农历天干、地支、属相 ==>NongliStr
NongliStr = lunar calendar & TianGan (curYear-4) Mod 60) Mod 10) & DiZhi (curYear-4) Mod 60) Mod 12) & "year"
NongliStr = NongliStr & "(& ShuXiang (curYear-4) Mod 60) Mod 12) &") "
'generate lunar month and day = > NongliDayStr
If (curMonth < 1) Then
NongliDayStr = "leap" & MonName (- 1 * curMonth)
Else
NongliDayStr = MonName (curMonth)
End If
NongliDayStr = NongliDayStr & "month"
NongliDayStr = NongliDayStr & DayName (curDay)
Nl = NongliStr & NongliDayStr
End Function
Msgbox nl
At this point, the study on "how to write VBS code to display the lunar calendar" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.