2 Replies Latest reply on Apr 21, 2015 7:04 AM by philmodjunk

# Calculation of days

### Title

Calculation of days

### Post

Hello, I have 2 fields c_tenure and cTenure_combined.

cTenure

Let (span = Get ( CurrentDate ) - Date Hire;(Year  (span)) - 1  &  "yrs" & (Month  (Span))  - 1 & "mos"  & (Day (span) ) - 1  & "days")

cTenure_combined

Let ( [ d = cTotal_cTenure_days ;
mc = Div ( d ; 30 ) ; // number of months to "carry" over to the months total.
m = cTotal_cTenure_months + mc ;
yc = Div ( m ; 12 ) ; // number of years to "carry" over
y = cTotal_cTenure_years + yc
] ;
y & " years " & Mod ( m ; 12 ) & " months " &  Mod ( d ; 30 )  &" days"
)

Both of these work perfectely as they are but now I would like to total these 2 fields into a cTenure_grand_total field.  I can add the 2 fields but the resluts are not in the years, months and days like the other 2 fields, can someone please help with a calc to add these 2 where the field cTenure_grand_total read ? years ?Mos ?Days.

Any help is appreciated.

• ###### 1. Re: Calculation of days

FileMaker Pro 11

• ###### 2. Re: Calculation of days

the second calculation refers to calculation fields that you do not show definitions for.

Both result in text results that cannot be added like they are numbers or date data values.

If you can get the same type of value as "span" in the first calc for the second calculation, you can add those two span values (which are the number days between two dates--an integer) and then treat it as a date the way you do span in the first calculation, you can total your results and then extract the year, month and day figures.