[Modify] Gregorian calendar to Lunar Calendar

Source: Internet
Author: User
'2017 ~ 2100 private const yldata = "bytes, numbers," & _ "010010101120.210,101001011011060130, numbers, numbers, 0101011010104204,1011011010020123, numbers," & _ "average, minimum, minimum, hour, hour, "& _" Hour, hour 1101110130124,10010110000211, hour, "& _" Hour, hour, hour, 100100101101000202,1101001011020122, hour, "& _" Hour, hour, hour, hour, hour, hour, "& _" Hour, hour, "& _" hour, 010010101101000215,101001101000203, hour, hour, 1011010426207,1001011010160128, "& _" hour, hour, 1011001001110a0202, hour, hour, 100101010111000206, "& _" Hour, hour, "& _" hour, 1101010010104212,110100101000201, hour, "& _" 101010010101000214,10110100100000203, medium, large, "& _" average, maximum, minimum, maximum, "& _" average, 100101101101000211,010 01010110b0131, minimum, 110100001011160128,110100100101000215, medium, "& _" average, minimum, maximum, 01101101000000214,101101100000202, "& _" average, minimum, maximum, minimum, minimum, "& _" average, minimum, 110101001010000217,110100100000205, large, large, "& _" large, small, medium, large, small, "& _" large, small, medium, large, large, "& _" 111010010110080130,110101000000218, 110110102017207,0110101010160127, 0101101101000215,01001011108205, 101010011101040125, 101000101101000212, 110100010101000,,11100101020121, 110101010010000209 "Private const ylmd0 =" october 29, 80 or 90 "Private const ylmn0 =" Winter wax "Private const yltiangan0 =" A, B, C, E, Geng, Xin, Xi "Private const yldizhi0 =" Zi ugly Yin, Mao Chen, Wu Wei shen Hai "Private const ylshu0 =" rat, ox, Tiger, Rabbit, dragon, Snake, horse, monkey, chicken, dog, and pig "'calendar date to Lunar Calendar function getnldate (byval strdate as string) as string if not isdate (strdate) then return "" dim setdate as date dim tyear, tmonth, tday as integer 'setdate = cdate (strdate) tyear = year (setdate ): tmonth = month (setdate): tday = cdate (setdate ). tostring ("DD") 'beyond the range of if tyear> 2100 orelse tyear <1901 then return "" 'dim dalist (1) as string dim condate as date dim thismonths as string dim addyear, addmonth, addday, getday, runyue1, mdays, I, j as integer dim ylyear, ylshuxing as string dim dd0, mm0 as string dim Ganzhi (59) as string dim runyue as Boolean try 'Load the lunar data dalist (0) = yldata within 2 years. substring (tyear-1900-1) * 19, 18) dalist (1) = yldata. substring (tyear-1900) * 19, 18) addyear = tyear j = 1 While true addmonth = CINT (mid (dalist (J), 15, 2 )) addday = CINT (mid (dalist (J), 17, 2) condate = dateserial (addyear, addmonth, addday) 'lunar New Year date getday = datediff (dateinterval. day, condate, setdate) + 1' difference days if getday> 0 Then exit while addyear-= 1 J-= 1 end while thismonths = left (dalist (J), 14) runyue1 = Val ("& H" & right (thismonths, 1) 'leap month if runyue1> 0 then' has a leap month thismonths = left (thismonths, runyue1) & Mid (thismonths, 13, 1) & Mid (thismonths, runyue1 + 1) end if thismonths = left (thismonths, 13) for I = 1 to 13 'computing days mdays = 29 + CINT (mid (thismonths, I, 1 )) if getday> mdays then getday = getday-mdays else if runyue1> 0 then if I = runyue1 + 1 then runyue = true if I> runyue1 then I = I-1 end if addmonth = I addday = getday exit for end if next dd0 = mid (ylmd0, (addday-1) * 2 + 1, 2) mm0 = mid (ylmn0, addmonth, 1) + "month" for I = 0 to 59 Ganzhi (I) = mid (yltiangan0, (I mod 10) + 1, 1) + mid (yldizhi0, (I mod 12) + 1, 1) Next ylyear = Ganzhi (addyear-4) moD 60) ylshuxing = mid (ylshu0, (addyear-4) mod 12) + 1, 1) if runyue then mm0 = "Hangzhou" & mm0 catch ex as exception return "" end try return "Lunar calendar:" & ylyear & "(" & ylshuxing &") year "& mm0 & dd0 end Function

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.