Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

Calculation questions should go in the Define Fields forum, but here are two possible solutions:

Month(DateTo) - Month(DateFrom)

or

Truncate((DateTo - DateFrom / 30, 0)

Depends on how you define "number of months between".

Posted

Ender said:

Month(DateTo) - Month(DateFrom)

Oops, This does not work if dates are from different years.

Posted

Hi Ender,

I like your calculations, but I had to modify this one,

Ender said:

Truncate((DateTo - DateFrom / 30, 0)

to this to get it to work:

Truncate((Next Payment Due - Payment Date) / 30, 0)

???

Posted

((Year (DateTo) - Year (DateFrom)) * 12 ) + Month (DateTo) - Month (DateFrom)

I'm reluctant to use any date calculations that assume a month is 30 days or a year is 365; it's hard-coding errors and inaccuracies into the system.

FMP has date functions that can work all this stuff out correctly, automatically taking into account leap years and other vagaries of the calendar.

Posted

My thought on that was getting an answer to this:

DateFrom: 2/15/2004

DateTo: 4/1/2004

One might say only "1 month" had passed during that period, because we tend to truncate when we talk about duration (I say I'm 30 years old, not 30.5) But of course you are correct to take into account different length months. If the dates are:

DateFrom: 2/15/2004

DateTo: 3/15/2004

The result should be "1 month". My calc did not take this into account.

Posted

Oops, I have a typo in my calculation in the script

Lee Smith said:

Script

Set Field [

This topic is 7510 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.