以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  公历农历如何互换  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=154649)

--  作者:yfy13338431925
--  发布时间:2020/9/21 23:00:00
--  公历农历如何互换
蓝老师,实例传上,帮我看看,公历农历互换该怎么做?
自作了公历转农历。
If e.DataCol.name = "公历日期" Then
    If e.NewValue = Nothing Then
        e.DataRow("农历日期") = Nothing
    Else
        e.DataRow("农历日期") = (New Lunar(e.NewValue)).LunarDate
    End If
End If
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目14.table



--  作者:lhpc120
--  发布时间:2020/9/21 23:43:00
--  
农历转换公历或者公历转换农历,那个又BUG,时间不准,应该按照天文台的数据计算
--  作者:有点蓝
--  发布时间:2020/9/22 8:47:00
--  
If e.DataCol.name = "公历日期" Then
    systemready = False
    If e.NewValue = Nothing Then
        e.DataRow("农历日期") = Nothing
    Else
        e.DataRow("农历日期") = (New Lunar(e.NewValue)).LunarDate
    End If
    systemready = True
ElseIf e.DataCol.name = "农历日期" Then
    systemready = False
    If e.NewValue = Nothing Then
        e.DataRow("公历日期") = Nothing
    Else
        Dim d As Date = e.NewValue
        e.DataRow("公历日期") = (New Lunar(d.Year,d.Month,d.Day,True)).SolarDate
    End If
    systemready = True
End If

至于是不是闰月,要自己建一个表,记录所有的闰月,然后查表判断