> If Abs(DateDiff("d", newDate, mvarDate)) = 0 Then tempStr = SolarTerm(i - 1) Exit For End If Next lSolarTerm = tempStr End Property ''''计算按第几周星期几计算的节日 Public Property Get wHoliday() As String Dim w As Long Dim i As Long Dim b As Long Dim FirstDay As Date Dim tempStr As String b = UBound(wHolidayInfo) For i = 0 To b If wHolidayInfo(i).Month = mvarsMonth Then ''''当月份相当时 w = WeekDay(mvarDate) If wHolidayInfo(i).WeekDay = w Then ''''仅当星期几也相等时 FirstDay = mvarsMonth & "/" & 1 & "/" & mvarsYear ''''取当月第一天 If (DateDiff("ww", FirstDay, mvarDate) = wHolidayInfo(i).WeekAtMonth) Then tempStr = wHolidayInfo(i).HolidayName End If End If End If Next wHoliday = tempStr End Property
Public Property Get lHoliday() As String Dim i As Long Dim b As Long Dim tempStr As String Dim oy As Long Dim odate As Date Dim ndate As Date 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 &n
上一页 [1] [2] [3] [4] [5] [6] 下一页 没有相关教程
|