Fortune Telling Collection - Fortune-telling birth date - Calculating lunar calendar with vb
Calculating lunar calendar with vb
Dim WeekName(7),month addd( 1 1),NongliData(99),TianGan(9),DiZhi( 1 1),ShuXiang( 1 1),DayName(30),MonName( 12)
Dim curTime、curYear、curMonth、curDay、curWeekday
Dim GongliStr,WeekdayStr,NongliStr,NongliMonStr,NongliDayStr
Dim i,m,n,k,isEnd,bit,TheDate
Common function wYear(curTime is date, Year or Day is integer)
CurTime is the date that needs to be converted, and YearOrDay is the result that needs to be output.
The value of "YearOrDay" is 0= year, month and day, 1= lunar year only, 2= month and day only, and 3= lunar festival.
4= month only, 5= day only.
Get the current system time
curTime = CDate("2008-4- 18 ")
Name of the week
WeekName(0) = " * "
WeekName( 1) = "Sunday "
WeekName(2) = "Monday"
Day Name (3) = "Tuesday"
WeekName(4) = "Wednesday"
WeekName(5) = "Thursday"
Day Name (6) = "Friday"
WeekName(7) = "Saturday"
Tianganming
Heavenly dry (0) = "one"
Tiangan (1) = "b"
Tiangan (2) = "C"
Tiangan (3) = "Ding"
Tiangan (4) = "E"
Heavenly dry (5) = "self"
Tiangan (6) = "more"
Tiangan (7) = "Heart"
Tiangan (8) = "Ren"
Tiangan (9) = "Deck"
Name of earthly branch
Dizhi (0) = "Zi"
Vertical (1) = "ugly"
Vertical (2) = "Yin"
Di Zhi (3) = "Mao"
Di Zhi (4) = "Chen"
Vertical (5) = "Yes"
Vertical (6) = "noon"
Question 7) = "No"
Dizhi (8) = "Shen"
Dizhi (9) = "unitary"
Vertical (10) = "Xu"
Vertical (1 1) = "sea"
Animal constellation 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 (1 1) = "pig"
Lunar date name
DayName(0) = "* "
DayName( 1) = "Grade One"
DayName(2) = "Grade 2"
DayName(3) = "Grade Three"
Day Name (4) = "Level 4"
DayName(5) = "Day 5"
DayName(6) = "Day 6"
DayName(7) = "Day 7"
Day name (8) = "Grade 8"
DayName(9) = "Day 9"
DayName( 10) = "Day 10"
Day name (1 1) = "Eleven"
DayName( 12) = "Twelve"
DayName( 13) = "thirteen"
Day name (14) = "14"
Day name (15) = "15"
DayName( 16) = "16"
DayName( 17) = "17"
Day name (18) = "18"
DayName( 19) = "Nineteen"
DayName(20) = "Twenty "
Day name (2 1) = "2 1 "
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) = "thirty"
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( 1 1) = "Eleven"
MonName( 12) = "La "
The first few days of each month in the Gregorian calendar
MonthAdd(0) = 0
month addd( 1)= 3 1
MonthAdd(2) = 59
MonthAdd(3) = 90
MonthAdd(4) = 120
MonthAdd(5) = 15 1
month addd(6)= 18 1
MonthAdd(7) = 2 12
MonthAdd(8) = 243
MonthAdd(9) = 273
month addd( 10)= 304
month addd( 1 1)= 334
Lunar data
NongliData(0) = 2635
NongliData( 1) = 333387
NongliData(2) = 170 1
NongliData(3) = 1748
NongliData(4) = 26770 1
NongliData(5) = 694
NongliData(6) = 239 1
NongliData(7) = 133423
NongliData(8) = 1 175
NongliData(9) = 396438
NongliData( 10) = 3402
NongliData( 1 1)= 3749
NongliData( 12)= 33 1 177
NongliData( 13)= 1453
NongliData( 14) = 694
NongliData( 15)= 20 1326
NongliData( 16) = 2350
NongliData( 17)= 465 197
NongliData( 18)= 322 1
NongliData( 19) = 3402
NongliData(20) = 400202
NongliData(2 1)= 290 1
NongliData(22) = 1386
NongliData(23)= 2676 1 1
NongliData(24) = 605
NongliData(25) = 2349
NongliData(26)= 1375 15
NongliData(27) = 2709
NongliData(28) = 464533
NongliData(29) = 1738
NongliData(30) = 290 1
NongliData(3 1)= 33042 1
NongliData(32) = 1242
NongliData(33) = 265 1
NongliData(34) = 199255
NongliData(35) = 1323
NongliData(36) = 529706
NongliData(37) = 3733
NongliData(38) = 1706
NongliData(39) = 398762
NongliData(40) = 274 1
NongliData(4 1)= 1206
NongliData(42) = 267438
NongliData(43) = 2647
NongliData(44)= 13 18
NongliData(45) = 204070
NongliData(46) = 3477
NongliData(47) = 46 1653
NongliData(48) = 1386
NongliData(49) = 24 13
NongliData(50) = 330077
NongliData(5 1)= 1 197
NongliData(52) = 2637
NongliData(53) = 268877
NongliData(54) = 3365
NongliData(55)= 53 1 109
NongliData(56) = 2900
NongliData(57) = 2922
NongliData(58) = 398042
NongliData(59) = 2395
NongliData(60)= 1 179
NongliData(6 1)= 2674 15
NongliData(62) = 2635
NongliData(63) = 66 1067
NongliData(64)= 170 1
NongliData(65) = 1748
NongliData(66) = 398772
NongliData(67) = 2742
NongliData(68) = 239 1
NongliData(69) = 33003 1
NongliData(70)= 1 175
NongliData(7 1)= 16 1 1
NongliData(72) = 2000 10
NongliData(73) = 3749
NongliData(74) = 5277 17
NongliData(75) = 1452
NongliData(76) = 2742
NongliData(77) = 332397
NongliData(78) = 2350
NongliData(79) = 3222
NongliData(80) = 268949
NongliData(8 1) = 3402
NongliData(82) = 3493
NongliData(83) = 133973
NongliData(84) = 1386
NongliData(85) = 4642 19
NongliData(86) = 605
NongliData(87) = 2349
NongliData(88) = 334 123
NongliData(89) = 2709
NongliData(90) = 2890
NongliData(9 1) = 267946
NongliData(92) = 2773
NongliData(93) = 592565
NongliData(94)= 12 10
NongliData(95) = 265 1
NongliData(96) = 395863
NongliData(97) = 1323
NongliData(98) = 2707
NongliData(99) = 265877
Generate the current Gregorian calendar year, month and day = => Gong Li.
curYear = Year(curTime)
CurMonth = month (curTime)
curDay = Day(curTime)
Gong gongli str = curyear & "year"
if(curMonth & lt; 10)
Gong liStr = gong GongliStr & amp0 & amp; Ke Yue&"Moon"
other
Gong liStr = gong gonglistr & ke yue&"moon"
If ... it will be over.
if(curDay & lt; 10)
Gong liStr = gong GongliStr & amp0 & amp; Curday & "day"
other
Gong liStr = gong GongliStr & ampcurDay & amp "day"
If ... it will be over.
Generate the current Gregorian calendar week = => working day Str
CurWeekday = working day (curTime)
WeekdayStr = WeekName(curWeekday)
Start time1921Days from February 8th: 192 1-2-8 (the first day of the first month).
the date =(cur year- 192 1)* 365+Int((cur year- 192 1)/4)+curDay+month add(cur month- 1)-38
If ((curYear Mod 4) = 0 and curMonth & gt2) then
Date = date+1
If ... it will be over.
Calculate the heavenly stems and earthly branches month and day of the lunar calendar.
isEnd = 0
m = 0
do
if(NongliData(m)& lt; 4095) So
k = 1 1
other
k = 12
If ... it will be over.
n = k
do
If (n<0) then
Exit Do
If ... it will be over.
Gets the value of the nth binary bit of NongliData(m)
bit = NongliData(m)
For i = 1 to n steps 1
bit = Int(bit / 2)
then
bit = bit Mod 2
if(the date & lt; = 29+bits) Then
isEnd = 1
Exit Do
If ... it will be over.
TheDate = TheDate-29 digits
n = n - 1
ring
If (isEnd = 1) then
Exit Do
If ... it will be over.
m = m + 1
ring
curYear = 192 1 + m
curMonth = k - n + 1
curDay = TheDate
If (k = 12) then
If (Curmonth = (int (nonglidata (m)/65536)+1)), then
curMonth = 1 - curMonth
else if(cur month & gt; (int (nonglidata (m)/65536)+1)) and then
curMonth = curMonth - 1
If ... it will be over.
If ... it will be over.
Generation of heavenly stems and earthly branches Zodiac of Lunar New Year = => Non-list.
NongliStr = TianGan((cur year-4)Mod 60)Mod 10); Di Zhi ((4 years) mode 60) mode12); "year"
NongliStr = NongliStr & amp"(" & Shuxiang ((4 years) mod 60) mod12); ")"
NongliStr = "Lunar New Year"&; NongliStr NongliStr is a year of the lunar calendar.
Generate lunar month and day = = > non-calendar str
if(curMonth & lt; 1) and then
NongliDayStr = " leap " &; MonName(- 1 * curMonth)
other
NongliDayStr = MonName(curMonth)
If ... it will be over.
Nongli monstr = nongli daystr & "moon"
Nonglidaystr = dayname (cur day)' nonglidaystr is the month and day.
GongliStr = "Gregorian calendar"&; Here is the Gregorian calendar date.
Wyear = nonglistr & non-holiday hotel & vbcrlf &; Gong Li site
Wyear = nonglistr & non-liDayStr
Select case year or day.
Case 0
Wyear = nonglistr & nonglistr & non-liDayStr
Case 1
wYear = NongliStr
Case 2
Wyear = nongli monstr & non-liDayStr
Case 3
Select case nongli monstr & non-liDayStr
Case "the first day of the first month" and "the first day of the first month"
WYear = "Spring Festival"
Case "fifteenth day of the first month" and "fifteenth day of the first month"
WYear = "Lantern Festival"
Cases "the fifth day of May" and "the fifth day of leap May"
WYear = "Dragon Boat Festival"
"July 7th" and "Leap 7th" Cases
WYear = "Valentine's Day in China"
Cases "July 15th" and "Leap July 15th"
WYear = "Mid-Autumn Festival"
Cases "August 15th" and "Leap August 15th"
WYear = "Mid-Autumn Festival"
Cases "September 9th" and "Leap September 9th"
WYear = "Double Ninth Festival"
Cases "the eighth day of the twelfth lunar month" and "the eighth day of the twelfth lunar month"
WYear = "Laba Festival"
Cases "Twenty-three of the twelfth lunar month" and "Twenty-three of the twelfth lunar month"
WYear = "off-year"
Cases of "twelfth lunar month" and "leap twelfth lunar month"
WYear = "New Year's Eve"
Other cases
wYear = " "
End selection
Case 4
wYear = NongliMonStr
Case 5
wYear = NongliDayStr
End selection
End function
Function sGongliJieri (SD date)
Dim sJieriDay( 100),sJieriName( 100)
sJieriDay(0) = " "
sJieriDay( 1)= " 0 10 1 "
sJieriDay(2) = "0202 "
sJieriDay(3) = "02 10 "
sJieriDay(4) = "02 14 "
sJieriDay(5) = "030 1 "
sJieriDay(6) = "0303 "
sJieriDay(7) = "0305 "
sJieriDay(8) = "0308 "
sJieriDay(9) = "03 12 "
sJieriDay( 10)= " 03 14 "
sJieriDay( 1 1)= " 03 15 "
sJieriDay( 12)= " 03 17 "
sJieriDay( 13)= " 032 1 "
sJieriDay( 14) = "0322 "
sJieriDay( 15) = "0323 "
sJieriDay( 16) = "0324 "
sJieriDay( 17) = "0325 "
sJieriDay( 18) = "0330 "
sJieriDay( 19)= " 040 1 "
sJieriDay(20) = "0407 "
sJieriDay(2 1) = "0422 "
sJieriDay(22) = "0423 "
sJieriDay(23) = "0424 "
sJieriDay(24) = "050 1 "
sJieriDay(25) = "0504 "
sJieriDay(26) = "0505 "
sJieriDay(27) = "0508 "
sJieriDay(28) = "05 12 "
sJieriDay(29) = "05 15 "
sJieriDay(30) = "05 17 "
sJieriDay(3 1)= " 05 18 "
sJieriDay(32) = "0520 "
sJieriDay(33) = "0523 "
sJieriDay(34) = "053 1 "
sJieriDay(35) = "060 1 "
sJieriDay(36) = "0605 "
sJieriDay(37) = "0606 "
sJieriDay(38) = "06 17 "
sJieriDay(39) = "0623 "
sJieriDay(40) = "0625 "
sJieriDay(4 1) = "0626 "
sJieriDay(42) = "070 1 "
sJieriDay(43) = "0702 "
sJieriDay(44) = "0707 "
sJieriDay(45)= " 07 1 1 "
sJieriDay(46) = "0730 "
sJieriDay(47) = "080 1 "
sJieriDay(48) = "0808 "
sJieriDay(49) = "08 15 "
sJieriDay(50) = "0908 "
sJieriDay(5 1) = "0909 "
sJieriDay(52) = "09 10 "
sJieriDay(53) = "09 14 "
sJieriDay(54) = "09 16 "
sJieriDay(55) = "09 18 "
sJieriDay(56) = "0920 "
sJieriDay(57) = "0927 "
sJieriDay(58) = "0928 "
sJieriDay(59)= " 100 1 "
sJieriDay(60) = " 1002 "
sJieriDay(6 1)= " 1003 "
sJieriDay(62) = " 1004 "
sJieriDay(63) = " 1006 "
sJieriDay(64) = " 1008 "
sJieriDay(65) = " 1009 "
sJieriDay(66)= " 10 10 "
sJieriDay(67)= " 10 13 "
sJieriDay(68)= " 10 14 "
sJieriDay(69)= " 10 15 "
sJieriDay(70)= " 10 16 "
sJieriDay(7 1)= " 10 17 "
sJieriDay(72) = " 1022 "
sJieriDay(73) = " 1024 "
sJieriDay(74)= " 103 1 "
sJieriDay(75)= " 1 107 "
sJieriDay(76)= " 1 108 "
sJieriDay(77)= " 1 109 "
sJieriDay(78)= " 1 1 10 "
sJieriDay(79)= " 1 1 1 1 "
sJieriDay(80)= " 1 1 12 "
sJieriDay(8 1)= " 1 1 14 "
sJieriDay(82)= " 1 1 17 "
sJieriDay(83)= " 1 120 "
sJieriDay(84)= " 1 12 1 "
sJieriDay(85)= " 1 122 "
sJieriDay(86)= " 1 129 "
sJieriDay(87)= " 120 1 "
sJieriDay(88) = " 1203 "
sJieriDay(89) = " 1205 "
sJieriDay(90) = " 1208 "
sJieriDay(9 1)= " 1209 "
sJieriDay(92)= " 12 10 "
sJieriDay(93)= " 12 12 "
sJieriDay(94)= " 12 13 "
sJieriDay(95) = " 1220 "
sJieriDay(96)= " 122 1 "
sJieriDay(97) = " 1224 "
sJieriDay(98) = " 1225 "
sJieriDay(99) = " 1226 "
sJieriName(0) = " "
SJieriName( 1) = "New Year's Day"
SJieriName(2) = "World Wetlands Day"
SJieriName(3) = "International Meteorological Festival"
SJieriName(4) = "Valentine's Day"
SJieriName(5) = "International Seal Day"
SJieriName(6) = "National Ear Love Day"
SJieriName(7) = "Lei Feng Memorial Day"
SJieriName(8) = "Women's Day"
SJieriName(9) = "Arbor Day, the anniversary of Sun Yat-sen's death"
SJieriName( 10) = "International Police Day"
SJieriName( 1 1) = "Consumer Rights Day"
SJieriName( 12) = "China Ethnic Medicine Festival, International Navigation Day"
SJieriName( 13) = "World Forest Day, International Day for the Elimination of Racial Discrimination, World Children's Song Day"
SJieriName( 14) = "World Water Day"
SJieriName( 15) = "World Meteorological Day"
SJieriName( 16) = "World Tuberculosis Day"
SJieriName( 17) = "National Safety Education Day for Primary and Secondary School Students"
SJieriName( 18) = "Palestinian Land Day"
SJieriName( 19) = "April Fool's Day"
SJieriName(20) = "World Health Day"
SJieriName(2 1) = "Earth Day"
SJieriName(22) = "World Book and Copyright Day"
SJieriName(23) = "Asian-African Journalists' Day"
SJieriName(24) = "Labor Day"
SJieriName(25) = "Youth Day"
SJieriName(26) = "IDD Prevention Day"
SJieriName(27) = "World Red Cross Day"
SJieriName(28) = "International Nurses' Day"
SJieriName(29) = "International Family Day"
SJieriName(30) = "International Telecommunication Day"
SJieriName(3 1) = "International Museum Day"
SJieriName(32) = "National Student Nutrition Day"
SJieriName(33) = "International Milk Day"
SJieriName(34) = "World No Tobacco Day"
SJieriName(35) = "International Children's Day"
SJieriName(36) = "World Environmental Protection Day"
SJieriName(37) = "National Eye Protection Day"
SJieriName(38) = "Day to Combat Desertification and Drought"
SJieriName(39) = "International Olympic Day"
SJieriName(40) = "National Land Day"
SJieriName(4 1) = "International Day Against Drug Abuse"
SJieriName(42) = "Hong Kong's return to China, the Communist Party of China (CPC)'s birthday, World Architecture Day".
SJieriName(43) = "International Sports Journalists Day"
SJieriName(44) = "War of Resistance against Japanese Aggression Memorial Day"
SJieriName(45) = "World Population Day"
SJieriName(46) = "African Women's Day"
SJieriName(47) = "Army Day"
SJieriName(48) = "China Men's Day (Father's Day)"
SJieriName(49) = "War of Resistance against Japanese Aggression Victory Memorial Hall"
SJieriName(50) = "International Literacy Day, International Journalists Day"
SJieriName(5 1) = "Mao Zedong's Death Memorial"
SJieriName(52) = "Teachers' Day in China"
SJieriName(53) = "World Clean Earth Day"
SJieriName(54) = "International Ozone Layer Protection Day"
SJieriName(55) = "September 18th Incident Memorial Day"
SJieriName(56) = "International Tooth Love Day"
SJieriName(57) = "world tourism day"
SJieriName(58) = "Confucius' Birthday"
SJieriName(59) = "National Day Music Day, Old People's Day"
SJieriName(60) = "Struggle for Peace, Democracy and Freedom Day"
SJieriName(6 1) = "National Day Holiday"
SJieriName(62) = "World Animal Day"
SJieriName(63) = "Old People's Day"
SJieriName(64) = "National Hypertension Day, World Outlook Day"
SJieriName(65) = "World Postal Day, UPU Day"
Sjieriname (66) = "1911Revolution Memorial Day, World Mental Health Day"
SJieriName(67) = "World Health Day, International Teacher's Day"
SJieriName(68) = "World Standards Day"
SJieriName(69) = "International Day for the Blind (White Cane Festival)"
SJieriName(70) = "World Food Day"
SJieriName(7 1) = "World Day for the Eradication of Poverty"
SJieriName(72) = "World Traditional Medicine Day"
SJieriName(73) = "United Nations Day"
SJieriName(74) = "World Diligence Day"
SJieriName(75) = "October socialist revolution memorial day"
SJieriName(76) = "China Journalists' Day"
SJieriName(77) = "National Fire Safety Publicity and Education Day"
SJieriName(78) = "World Youth Day"
SJieriName(79) = "International Science and Peace Week (today belongs to this week)"
SJieriName(80) = "Sun Yat-sen's birthday anniversary"
SJieriName(8 1) = "World Diabetes Day"
SJieriName(82) = "International University Day, World Student Day"
SJieriName(83) = "Yi Nian"
SJieriName(84) = "World Greeting Day, World Television Day"
SJieriName(85) = "Yi Nian"
SJieriName(86) = "International Day of Solidarity with the Palestinian People"
SJieriName(87) = "World AIDS Day"
SJieriName(88) = "World Day of Disabled Persons"
SJieriName(89) = "International Volunteer Day for Economic and Social Development"
SJieriName(90) = "International Children's Television Day"
SJieriName(9 1) = "World Football Day"
SJieriName(92) = "World Human Rights Day"
Sjieriname (93) = "Xi Incident Memorial Day"
SJieriName(94) = "193 Nanjing Massacre Memorial Day"
SJieriName(95) = "To commemorate the return of Macao"
SJieriName(96) = "International Basketball Day"
SJieriName(97) = "Christmas Eve"
SJieriName(98) = "Christmas"
SJieriName(99) = "Mao Zedong's birthday celebration"
For i = 1 to 99
sJieriDay 1 = Left(sJieriDay(I),2)& amp; “-”& amp; Right (sjierday (I), 2)
nDay = CInt(CDate(sjieriday 1 & amp; “-”& amp; Year (sD))-Date (Month (SD)&; “-”& amp; Day (SD) and day. “-”& amp; Year (SD))
If nDay = 0, then
SGongliJieri = " Today " &; sJieriName(i)
Exit function
ElseIf nDay & gt So 0
SGongliJieri = " poor " &; Nday & "God"&; sJieriName(i)
Exit function
If ... it will be over.
then
End function
- Previous article:1994.11.12 What is the constellation? Introduce details
- Next article:This is a pig's lunar date fortune telling.
- Related articles
- Is February and March suitable for fortune telling _ Is February and March suitable for marriage?
- Has anyone ever met a fortune teller in Tibetan Mountain? How much did it cost? Is it true or a scam?
- Shunde roadside fortune teller _ Who is Shunde roadside fortune teller?
- The 66-year-old horse married the 67-year-old sheep, and the 66-year-old horse man and the 67-year-old sheep woman got married on 20 15.
- Douban recommended fortune telling _ Douban recommended fortune telling website
- Give me the names of all kinds of animals, martial arts, sects and cultivation stages?
- What about the girl who lives in the mountains?
- Li Chengru, a supporting role in the Millennium, is there anything to be proud of?
- Let's find a fortune teller named _ Let's find a fortune teller named.
- The fortune teller was stunned by the emperor _ The emperor fortune teller knelt down.