'做法都是用隔月的第一天減一天
'VB
Private Sub Command1_Click()
Dim d As Date
d = "2006/05/03"
MsgBox (DateAdd("M", 1, Format(d, "YYYY/MM") & "/01") - 1)
End Sub
'VB.NET
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim d As Date
d = "2006/05/03"
MsgBox(Date.Parse(d.AddMonths(1).ToString("yyyy/MM") & "/01").AddDays(-1))
End Sub
沒有留言:
張貼留言