# Calculate interval in y,m,d from set record date to current date

Question asked by ArthurJoyce on Jan 14, 2012
Latest reply on Jan 15, 2012 by ArthurJoyce

### Title

Calculate interval in y,m,d from set record date to current date

### Post

I'm trying to calculate in years, months, and days how long it is between a date on a past record in FileMaker to the current date.

I have a calculation field that I thought was working perfectly . . . until I got to 1/1/12 and then the calculation starting going backward.

The calculation in the calc field is:

GetAsText ( Year ( Get ( CurrentDate ) )  - Year ( SermonDate ) - If ( Get ( CurrentDate ) <  Date ( Month ( SermonDate ) ; Day ( SermonDate ) ; Year ( Get ( CurrentDate ) ) ) ; 1 ; 0 ) ) & " Years, " & GetAsText ( Mod ( Month ( Get ( CurrentDate ) ) - Month ( SermonDate ) + 12 - If ( Day ( Get ( CurrentDate ) ) < Day ( SermonDate ) ; 1 ; 0 ) ; 12 ) ) & " Months, " & GetAsText ( Day ( Get ( CurrentDate ) ) - Day ( SermonDate )  + If ( Day ( Get ( CurrentDate ) )  ≥ Day ( SermonDate ); 0 ; If ( Day ( Get ( CurrentDate ) - Day ( Get ( CurrentDate ) ) ) < Day ( SermonDate ) ; Day ( SermonDate ) ; Day ( Get ( CurrentDate ) - Day ( Get ( CurrentDate ) ) ) ) ) ) & " Days "

I have a date field that is labeled "SermonDate" and as I said, the above calculation seemed to be working until the beginning of this year. I've tried to find the flaw but I can't. Anyone have an idea what's wrong?

Thanks for any help given.