Wednesday, August 6, 2008

MS Access: How can I

How I Can Get How Many Days In A Month...?


Question

I want to know how many days in a month ...?  For example:
    
    February 1998 have 29 days
    February 1999 have 28 days

Are there function to get this information in access 97..?

Answer


Here is the most (?) effective solution:

Public Function GetMonthDays(ByVal vdat As Date) As Integer   GetMonthDays = Day(DateSerial(Year(vdat), Month(vdat) + 1, 0)) End Function

No comments: