以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]systemidle事件,阴历出错  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=117532)

--  作者:liuyixin662
--  发布时间:2018/4/14 9:01:00
--  [求助]systemidle事件,阴历出错

老师你好,今天打开FOX出错,以前一直正常.systemidle代码 如下;

static ln As New Lunar(Date.Today)
Dim str As String = ""
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

日期错误:2018-02-29

 

 


--  作者:liuyixin662
--  发布时间:2018/4/14 9:08:00
--  
以下是引用liuyixin662在2018/4/14 9:01:00的发言:

老师你好,今天打开FOX出错,以前一直正常.systemidle代码 如下;

static ln As New Lunar(Date.Today)
Dim str As String = ""
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

日期错误:2018-02-29

 

 


图片点击可在新窗口打开查看此主题相关图片如下:阴历出错.bmp
图片点击可在新窗口打开查看

--  作者:有点蓝
--  发布时间:2018/4/14 9:43:00
--  
\'今天是农历2018-2-29:
Dim ln As New Lunar(Date.Today)
Output.Show(ln.LunarDate)

----------
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

--  作者:liuyixin662
--  发布时间:2018/4/14 9:54:00
--  

谢谢老师