Brian Dunning's FileMaker Custom Functions

DaysInMonth ( text )

Calculates the number of days in a chosen month

  Average rating: 4.5 (11 votes) Log in to vote

Neil Manchester   Neil Manchester

Share on Facebook Share on Twitter

  Sample input:
DaysInMonth ( 16/02/2016 )
  Sample output:

  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.



comment   comment, VR
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 ) ) )

Log in to post comments.


Note: these functions are not guaranteed or supported by Please contact the individual developer with any questions or problems.

Under construction. Email me your wish list for improvements.