以文本方式查看主题

-  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=186070)

--  作者:zyxhx
--  发布时间:2023/4/4 22:21:00
--  如何显示农历闰月日期
老师,以下为显示农历日期的代码,如果遇到闰月,在日期前加上“闰”字,如“闰二月十四”,应该如何修改代码,请老师指点。

Dim ln As New Lunar(Date.Today)
Dim str As String = ""
Dim ar() As String = ln.LunarDate.Split("-")
If ar(1) = "2" AndAlso (ar(2) = "29" OrElse ar(2) = "30")
    str = "二月"
    If ar(2) = "29"
        str &= "二十九"
    Else
        str &= "三十"
    End If
Else
    Dim d As Date = cdate(ln.LunarDate)
    If d.Day <= 10 Then
        str = cldate(d).Substring(5).trim("日")
        str = str.Insert(str.Length-1, "初")
    Else
        str = cldate(d).Substring(5).trim("日")
    End If
End If
[此贴子已经被作者于2023/4/4 22:28:00编辑过]

--  作者:有点蓝
--  发布时间:2023/4/4 22:52:00
--  
If ln.IsLeapMonth Then
str  = “” & str 
End If

--  作者:zyxhx
--  发布时间:2023/4/5 15:52:00
--  
如果转换成这种方式呢?“癸卯兔年闰二月十五”
--  作者:有点蓝
--  发布时间:2023/4/6 8:57:00
--  
http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=150972&skin=0
--  作者:zyxhx
--  发布时间:2023/4/6 10:18:00
--  
看上去很复杂哟