Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 4297 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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

Posted

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)

Posted

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.

Posted

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

Posted

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.

This topic is 4297 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.