tempStr = "" b = UBound(lHolidayInfo) If mvarlMonth = 12 And (mvarlDay = 29 Or mvarlDay = 30) Then ''''保 oy = mvarlYear ''''保存农历年数 odate = mvarDate ndate = mvarDate + 1 Call sInitDate(Year(ndate), Month(ndate), Day(ndate)) ''''计算第二天的属性 If oy = mvarlYear - 1 Then ''''如果农历年数增加了1 tempStr = "除夕" Call sInitDate(Year(odate), Month(odate), Day(odate)) ''''恢复到今天原有数据
End If Else For i = 0 To b If (lHolidayInfo(i).Month = mvarlMonth) And _ (lHolidayInfo(i).Day = mvarlDay) Then tempStr = lHolidayInfo(i).HolidayName Exit For End If Next End If lHoliday = tempStr End Property ''''求公历节日 Public Property Get sHoliday() As String Dim i As Long Dim b As Long Dim tempStr As String
tempStr = "" b = UBound(sHolidayInfo) For i = 0 To b If (sHolidayInfo(i).Month = mvarsMonth) And _ (sHolidayInfo(i).Day = mvarsDay) Then tempStr = sHolidayInfo(i).HolidayName Exit For End If Next sHoliday = tempStr End Property ''''是否是农历的闰月 Public Property Get IsLeap() As Boolean IsLeap = mvarIsLeap End Property Public Property Get lDay() As Long lDay = mvarlDay End Property Public Property Get lMonth() As Long lMonth = mvarlMonth End Property Public Property Get lYear() As Long lYear = mvarlYear End Property Public Property Get sWeekDay() As Long sWeekDay = WeekDay(mvarDate) End Property Public Property Get sDay() As Long sDay = mvarsDay End Property Public Property Get sMonth() As Long sMonth = mvarsMonth End Property Public Property Get sYear() As Long sYear = mvarsYear End Property ''''//////////////////////////////////////////////////////////////////////////////////////////////////////// Public Function IsToday(y As Long, m As Long, d As Long) As Boolean
If (Year(Date) = y) And _ (Month(Date) = m) And _ (Day(Date) = d) Then IsToday = True Else IsToday = False End If
End Function
''''根据年份不同计算当年属于什么朝代 Public Function Era(y As Long) As String Dim tempStr As String
If y < 1874 Then tempStr = "未知" Else If y <= 1908 Then tempStr = "清朝光绪" If y = 1874 Then tempStr = tempStr & "元年" Else tempStr = tempStr & UpNumber(CStr(y - 1874)) & "年" End If Else If y <= 1910 Then tempStr = "清朝宣统" If y = 1909 Then tempStr = tempStr & "元年" Else tempStr = tempStr & UpNumber(CStr(y - 1909 + 1)) & "年" End If Else If y < 1949 Then tempStr = "中华民国" If y = 1912 Then tempStr = tempStr & "元年" Else tempStr = tempStr & UpNumber(CStr(y - 1912 + 1)) & "年" End If Else tempStr = "中华人民共和国成立" If y = 1949 Then tempStr = tempStr & "了" Else Select Case y Case 2000 tempStr = "千禧年" Case Else tempStr = tempStr & UpNumber(CStr(y - 1949)) & "周年" End Select End If End If End If End If End If
Era = tempStr End Function '''' 传入 num 传回干支, 0=甲子 Public Function GanZhi(num As Long) As String Dim tempStr As String Dim i As Long i = (num - 1864) Mod 60 ''''计算干支 tempStr = Gan(i Mod 10) & Zhi(i Mod 12) GanZhi = tempStr End Function ''''计算年的属相字串 Public Function YearAttribute(y As Long) As String YearAttribute = Animals((y - 1900) Mod 12) End Function ''''将数字汉化 Public Function UpNumber(Dxs As String) As String ''''检测为空时 If Trim(Dxs) = "" Then UpNumber = "" Exit Function End If
Dim Sw As Integer, SzUp As Integer, tempStr As String, DXStr As String Sw = Len(Trim(Dxs))