Software Venture Consulting

FileMaker Pro downloads & Resources
FileMaker Custom Functions
FileMaker Web Viewer Examples
FileMaker Pro & Lasso Consulting
FileMaker Books
FileMaker Articles
FileMaker Error Reference

Free Web Tools
Free FileMaker Tools

Personal Pages

Shopping Cart
Shopping Cart


Free Newsletter


Privacy Policy

FileMaker is a registered trademark of FileMaker, Inc. in the U.S. and other countries.


 FileMaker Pro Custom Functions

List  |  Show Random  |  Upload  |  Add This to Your Site

Months_Diff ( date1 ; date2 )

Rate this function:  

  Average rating: 4.0  (35 votes)
  Discuss this Custom Function

Ron Smith, PaperCutPro

Months difference part between two dates.

Sample Input:
Months_Diff ( 7/14/1958 , 4/15/2015 )
Sample Output:

 Then copy & paste into FileMaker Advanced's Edit Custom Function window.


This is the months difference between two dates which should be entered in with the earlier date first. Ex:

7/14/1958 - 9/8/2006 = 48years 6months 11days

This function could use similar coding as in my Days_Diff function which allows dates in no particular order.

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

This is my Custom Function and I want to edit it


Not sure how this meets anyones needs but the months difference between dates should take in to account the years. Even the sample input shown and output shown is not accurate. I am looking for the true number of months between 2 dates. Take a look at result in that 48 years 6 months and 11 days. Years are irrelevant in that it is a constant 12. July to September is not 6 months no matter how many leap years there are.

Aaron Beck, Lees Summit
July 22, 2013 12:32pm

It makes a great deal of difference when I am checking children and I need their years, month, and days. I use the three together and have for years in my custom EMR.

Warmest regards,


Ron SMith, McDonough, GA
July 22, 2013 1:28pm

This works to get true months touched between the two dates:

Year(Date2)=Year(Date1); If(Month(Date2) <> Month(Date1);1) + Abs(Month(Date2) - Month(Date1));
Year(Date2)>Year(Date1); 0 + If((GetAsDate(Date1))<GetAsDate(Date2); 1 + Months_Diff(Date ( Month(GetAsDate(Date1)+31) ; 1 ; Year(GetAsDate(Date1) +31) ); Date2));
Year(Date2)<Year(Date1); 0 + If((GetAsDate(Date2))<GetAsDate(Date1); -1 - Months_Diff(Date ( Month(GetAsDate(Date1)-31) ; 1 ; Year(GetAsDate(Date1) -31) ); Date2))


Aaron Beck, Lees Summit
July 22, 2013 1:30pm

The following formula is directly from the FileMaker help archive...

(Year(Date2 + 1) - Year(Date1 + 1)) * 12 + (Month(Date2 + 1) - Month(Date1 + 1)) - If (Day (Date2 + 1) = Day (Date1), 0, If (Day (Date2 + 1) < Day (Date1+1), 1, 0))

Tom Guise, Droitwich Spa
April 15, 2015 5:22am

Hi, Aaron. There appears to be a typo in that example output. I checked the code and it does work and is correct. I'll fix the example. I apologize for that error. Here is what I get when I look at my information in my EMR at this moment:

My date of birth: 7/14/58
Today's date: 4/15/2015

This calculates to 56 years 9 months 1 day.

Now each of the days and months and years function to give you what you need for years, months, and days. For me in Pediatrics, for example, I must know that a child is 12 months to the day before I give the MMR or it won't count and they'll have to get that first vaccine again.

Use the parts that you need, but I use the three together.

Warmest regards,

Ron Smith, MD

Ron Smith, McDonough, GA
April 15, 2015 6:41am

Make a comment about this Custom Function (please try to keep it brief & to the point). Anyone can post:

Your Name:
characters left. If you paste in more than 1500 characters, it will be truncated. Discuss the function - advertisements and other useless posts will be deleted.
Answer 2 + 2 =
Search for Custom Functions:

Custom Functions Widget
Download the Custom Function Dashboard Widget for OS X
Keep all the latest Custom Functions right at your fingertips!

Newest Custom Functions:

1. HexUUIDToNum_cf (_uuid)
  (Sat, Jun 16, 1:55pm)
2. httpResponseCode ( responseHeaders )
  (Tue, Jun 12, 10:40pm)
3. FindDuplicateCharacters ( string )
  (Fri, Jun 08, 5:01pm)
4. FieldRepetitionLast ( field ; maxRepetition )
  (Wed, Jun 06, 6:05pm)
5. CountModifiedRecords ( NameTimestampField ; StartTimestamp ; EndTimestamp )
  (Mon, May 28, 8:23am)
6. JSONArrayLength ( JSONArrayStr )
  (Fri, May 25, 7:46am)
7. interpolation (y1; y2; y3; x1; x2; x3; x1y1; x2y1; x1y2; x2y2; rnd)
  (Sat, May 19, 3:55am)
8. @JSONFormatElements ( json )
  (Tue, May 15, 3:31am)

RSS Feed of Custom Functions