Search Tools Links Login


'This function will use the computers clock to retrive the days in any month, including leap years.
'If you use this code then please leave your comments or even vote if you have time..

Original Author: Cux


'The are only two inputs one of which is optional.
'The First Is ValMonth which is the month you want to get the days for.
'The second is the year, if not obmited then the current year is used.


'This code is in a function, if you are not sure about functions then please read about them before using this code.


'The days in the month specifyed

Side Effects

'None that i know about, and there souldnt be any


'Please dont remove this TAG
'By CoderUX 31-10-2002
'Copy this code into your form or module
Public Function GetDaysInMonth(ByVal ValMonth As Double, Optional ByVal ValYear As Double) as double
On Error GoTo Handler:
If ValYear = Empty Then
GetDaysInMonth = DateDiff("D", "01/" & ValMonth & "/" & Format(Now, "YYYY"), DateAdd("M", 1, "01/" & ValMonth & "/" & Format(Now, "YYYY")))
GetDaysInMonth = DateDiff("D", "01/" & ValMonth & "/" & ValYear, DateAdd("M", 1, "01/" & ValMonth & "/" & ValYear))
End If
Exit Function
End Function

About this post

Posted: 2003-06-01
By: ArchiveBot
Viewed: 122 times


Visual Basic 6


No attachments for this post

Loading Comments ...


No comments have been added for this post.

You must be logged in to make a comment.