April 14, 201312 yr I need to calculate the number of months between two dates. Not the number of days, nor the number of years, just the number of months. Can anyone tell a poor old (still thinking in FMP 5) man how to do this? Thanks
April 15, 201312 yr This has been discussed before and one issue is how to define "a month". How exact does this need to be and what about the "edge" cases? What are you actually using this for? For your needs, how many months are there between: March 1st to March 31st (31 days) March 30th to April 29th (31 days) April 30th to May 30th (30 days) January 30th to February 28th (29 days) February 28th to March 28th (29 days)
April 15, 201312 yr http://help.filemaker.com/app/answers/detail/a_id/5139/~/calculation-for-elapsed-months
April 15, 201312 yr Author This does not need to be exact. I would define a "Month" as 30.4375 "days" (365.25/12 days). I need to define the age of cats, eligilbe for adoption, in a shelter. Also, "edge cases" do not matter.
April 15, 201312 yr Well, then subtracting Date1 from Date2 and dividing by 30.5 should be fine. Doug's linked function is ok, but fails in certain situations (eg 2/28/2013 to 3/30/2013 = 0 months).
April 15, 201312 yr Author I tried this field definition: = (// - CAT'S DATE OF BIRTH)/30.4375 And I got the following error message: "A number, text constant, field name or "(" is expected here" The cursor is positioned at the end of the definition. Cat's Date of Birth is defined as MM/DD/YYYY
April 15, 201312 yr The shortcut "//" is for display purposes only (as a placeholder for the current date in a text object on a layout). It doesn't work in a calculation. Use Get(CurrentDate) instead.
April 15, 201312 yr Author Solution Perfect - this is what comes of trying to fit an FMP5 square block into an FMP11 circular slot. Thanks for all your help!
Create an account or sign in to comment