|
真正的公农历转换类for VB(1)
公农历转换VB类 clsDate 网上流传很多计算公农历的源代码,很多,但是居然没有VB的,晕, 所以。。。。。 用法: 以l开始的方法均为阴历,以s开始的方法均为公历 基本的两个初使函数: lInitDate:用农历年月日初使化日期对象 sInitDate: 用公历年月日初使化日期对象 其它的方法看下面的一小段代码吧 示例代码 Private Sub Command1_Click() Dim t As clsDate Dim y As Long Dim m As Long Dim d As Long Dim st As Single Dim et As Single Dim da As Date Dim j As Long Dim ret As Long Set t = New clsDate 't.sInitDate 1900, 1, 1 t.lInitDate 2047, 5, 12, False '农历2047年5月12日,非闰月 Debug.Print t.lYear If t.IsLeap = False Then Debug.Print t.lMonth Else Debug.Print " 闰 " & t.lMonth End If Debug.Print t.CDayStr(t.lDay) '农历日期中文大写 Debug.Print t.GanZhi(t.lYear) '求干支 Debug.Print t.YearAttribute(t.lYear) '农历年的属相 Debug.Print t.sYear ' 公历年 Debug.Print t.sMonth ' 公历月 Debug.Print t.sDay ' 公历日 Debug.Print t.sWeekDay '公历星期 Debug.Print t.Era(t.sYear)' 公历纪元 Debug.Print t.Constellation(t.sMonth, t.sDay) ' 星座 Debug.Print "Week:" & t.wHoliday ' 按第几个星期几计算的假日 Debug.Print "Solar" & t.sHoliday ' 按公历计算的假日 Debug.Print "Lunar" & t.lHoliday ' 按阴历计算的假日 Debug.Print t.lSolarTerm ' 计算节气 '以下为速度测试,很快吧。
|