### 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.

http://help.filemaker.com/app/answers/detail/a_id/5532/~/calculate-the-age-of-a-person-in-years,-months-and-days

## Calculate the Age of a Person in Years, Months and Days

The following calculation fields demonstrate how to calculate a person's age. These calculations compare the value in an existing date field called "Birthdate" with the value obtained using the Get(CurrentDate) function.

YearsElapsedYears (calculation, number result) =

Year ( Get ( CurrentDate ) ) - Year ( Birthdate ) - If ( Get ( CurrentDate ) < Date ( Month ( Birthdate ) ; Day ( Birthdate ) ; Year ( Get ( CurrentDate ) ) ); 1 ; 0 )

MonthsElapsedMonths (calculation, number result) =

Mod ( Month ( Get ( CurrentDate ) ) - Month ( Birthdate ) + 12 - If ( Day ( Get ( CurrentDate ) ) < Day ( Birthdate ) ; 1 ; 0 ) ; 12 )

DaysElapsedDays (calculation, number result) =

Day ( Get ( CurrentDate ) ) - Day ( Birthdate ) + If ( Day ( Get ( CurrentDate ) ) ≥ Day ( Birthdate ) ; 0 ; If ( Day ( Get ( CurrentDate ) - Day ( Get ( CurrentDate ) ) ) < Day ( Birthdate ) ; Day ( Birthdate ) ; Day ( Get ( CurrentDate )- Day ( Get ( CurrentDate ) ) ) ) )

Please note that the three calculations listed above are not meant to be used independently. For example, the ElapsedDays calculation does not give you the number of days from one date to another; rather it gives you the remainder after you have calculated the number of years and months. The following formula combines the calculations above to display a person's age in the text format of "yy Years, xx Months, zz Days":

Full AgeFullAge (calculation, text result) =

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

David Anders

The Computer Guy, Seattle

http://localwebpromotion.wordpress.com