# 另一方法....DatePart() 与 DateAdd()函数

Posted by SuBird on April 08, 1999 at 10:53:27:

In Reply to: 写个Function供各位参考！ posted by SuBird on April 08, 1999 at 10:40:14:

Re:
小吴的方法也不错，下面也是方法之一，请参考

Private Sub Command1_Click()
Dim datEnterDate As Date
Dim intDaysOfMonth As Integer
datEnterDate = InputBox$("请输入一日期...", "输入")
intDaysOfMonth = DatePart("d", DateAdd("M", 1, datEnterDate - DatePart("d", datEnterDate)))
Text1.Text = intDaysOfMonth
End Sub

Follow Ups: