China Naming Network - Fortune telling knowledge - How to make perpetual calendar with VB

How to make perpetual calendar with VB

Making a perpetual calendar with VB, focusing on writing the lunar calendar. The reference code is as follows:

# Area "Return to Lunar New Year"

Return to the lunar calendar

CCalendar。 Returns the maximum supported date, that is, 2101-kloc-0/-28.

CCalendar。 Returns the minimum supported date, namely 190-2- 19.

Private calendar as a new system ..

The public function pubfun _ cndate (byval s datetime as date) in the form of a string.

CCalendar = new system ..

Dim lyear As Integer = cCalendar。 GetYear(sDateTime)

Dim lmonth As Integer = cCalendar。 GetMonth(sDateTime)

Dim lday As Integer = cCalendar。 (sDateTime)

Dim lweek As Integer = cCalendar。 (sDateTime)

Gets the leap month, where 0 means there is no leap month.

dim leap month As Integer = cCalendar。 (Lill)

Dim isleap As Boolean = False

if(leap month & gt; 0) Then

If(leap month = lmonth) then

leap month—intercalary month in the lunar calendar

isleap = True

lmonth = lmonth - 1

else if(lmonth & gt; Then a month.

lmonth = lmonth - 1

If ... it will be over.

If ... it will be over.

Returns a string. Concat((lYear), IIF(islap = true, "leap year", "year"), (lmonth), "month", (lday))

End function

Ten days' work

Private tiangan As String()= {“A A, B, C, D, E, Ji, Geng, Xin, Man and Ghost}

Twelve earthly branches

Private di As String()= {Zi, Ugly, Yin, Mao, Chen, Si, Wu, Wei, Shen, You, Xu and Hai}.

zodiac

Private Xiao Sheng As String()= {mouse, cow, tiger, freedom, dragon, snake, horse, sheep, monkey, chicken, dog and pig}.

lunar month

Private months As String()= {"Zheng", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven" and "Twelve"}

Lunar calendar day

Privatedays1asstring () = {"Chu", "Ten", "Twenty" and "Three"}

Private days String()= {One, Two, Three, Four, Five, Six, Seven, Eight, Nine and Ten}

Return to the Lunar New Year (heavenly stems and earthly branches Zodiac)

Private function in string form (ByVal year in integer form)

= ""

If (year & gt Then what?

dim tgIndex As Integer =(year-4)Mod 10

dim dz index As Integer =(year-4)Mod 12

Return to Tiangan (tgIndex) and di(dz index) and "["& Xiao Sheng Stock Exchange "]".

If ... it will be over.

Invalid year!

End function

Back to the zodiac

Private function in string form (ByVal sDateTime As Date)

Return to Xiao Sheng (calendar. (cCalendar。 getsexagenary year(sDateTime)- 1)

End function

Return to the lunar month

Private function GetLunisolarMonth in string form (ByVal month in integer form)

GetLunisolarMonth =““

If (0 month), then

Returns the month (month-1)

If ... it will be over.

Invalid month!

End function

Return to Lunar New Year

Private function GetLunisolarDay in string form (ByVal day in integer form)

GetLunisolarDay =““

if(day & gt; 0 and another day

If (20th and 30th days) then

Returns a string. concat(days 1((day- 1)\ 10),days((day- 1)Mod 10)

other

Returns a string. Concat (days ((days-1)\ 10), days 1( 1))

If ... it will be over.

If ... it will be over.

Invalid date!

End function

# End area