Private Function GetLastDayOfMonth(d As Date) As IntegerCara Kedua:
GetLastDayOfMonth = DateDiff("d", Format$(d, "mm/yyyy"), Format$(DateAdd("m", 1, d), "mm/yyyy"))
End Function
Private Function GetLastDayOfMonth(d As Date) As StringContoh Penggunaan:
GetLastDayOfMonth = DateAdd("m", 1, DateSerial(Year(d), Month(d), 1)) - 1
End Function
Private Sub Command2_Click()
Dim d As Date
d = #7/13/2012#
MsgBox GetLastDayOfMonth(d)
End Sub