CodeItBetter Programming Another VB Programming Blog

How to Count Number Of day In a month

Posted on January 4, 2012
1
2
3
4
5
6
7
8
9
10
11
12
13
14
'Date & Time - How to Count Number Of day In a month
Private Sub Command1_Click()
    MsgBox DaysInMonth("20/07/2006")
End Sub
 
Public Function DaysInMonth(ByVal dDate As Date) As Integer
    DaysInMonth = Day(DateAdd("m", 1, dDate - Day(dDate) + 1) - 1)
End Function
 
'or 

Public Function DaysInMonth(dDate As Date) As Integer
    DaysInMonth = Day(DateSerial(Year(dDate), Month(dDate) + 1, 0))
End Function
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.