DaysInMonth ( text )
Calculates the number of days in a chosen month
Average rating: 4.5 (11 votes) Log in to vote
Neil Manchester - Show more from this author
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
This is a simple CF that returns the number of days in a given month taking into account leap years.
Aug 21, 2016
First, your calculation of leap years is incorrect. You will get a wrong result for the month of February 2100, for example.
Next, you should not prefix your variables with $, because these hang around until the end of the session - and they might interfere when the function is called again.
Finally, the number of days in a given month can be calculated much more simply as:
Day ( Date ( Month ( GivenDate ) + 1 ; 0 ; Year ( GivenDate ) ) )
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.