Function Days In Month()




***Function DaysInMonth() ***

This function will generate a number of days from the input month. For example, if 6/4/2016 is input into the function like DaysInMonth(6/4/2016) the result will be “30” as June has 30 days in the month. The LeapYear function also is used in the DaysInMonth function.

VB Code:

function

leapyear

How to Use It:

You can put the above functions on current form or in the Module.

If you want to know the number of days of the month from the input date the function will be like:
Input field = strDate
The number of days field = strNumber
Call function = DaysInMonth(Me.strDate)
If strDate = 6/2/2016 then
The result of strNumber = DaysInMonth(Me.strDate) will be “30”