以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  求帮助  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=88018)

--  作者:XU84988
--  发布时间:2016/7/25 9:59:00
--  求帮助
日期计算时,日为表达式,如何解决从字符串“2016-7-0”到类型Date的转换无效错误?
--  作者:大红袍
--  发布时间:2016/7/25 11:15:00
--  

Dim str As String = "2016-7-0"

Dim d As Date
If Date.TryParse(str, d) = False Then
    msgbox("不是正确的日期")
Else
    msgbox(d)
End If