I need a function that takes a month and year as input and returns the number of days for that month. Or preferably, a function that takes a year as input and tells whether it's a leap year or not.
Printable View
I need a function that takes a month and year as input and returns the number of days for that month. Or preferably, a function that takes a year as input and tells whether it's a leap year or not.
if you are asking for an inbuilt function to find leap year in vb6 then it is not available you have to write your own , same to do with the number of days
For a leap year function, this should workCode:Private Sub Form_Load()
MsgBox "2008 = " & IsLeapYear(2008)
MsgBox "2009 = " & IsLeapYear(2009)
End Sub
Private Function IsLeapYear(ByVal iYear As Integer) As Boolean
Dim strDate As String
strDate = "February 29, " & iYear
IsLeapYear = IsDate(strDate)
End Function