8 Replies Latest reply on Dec 7, 2016 12:12 PM by alquimby

    Calculating Elapsed Time Between two dates

    JulioSandoval

      Hello All,

       

      So I don't know if anyone else has had this issue before. But I like how the FM KB had this calculation as an example. But here is what I have:

       

      I have it set to use CurrentDate IF DecomissionDate is empty.

      Number_Of_Days Script:

      If (

       

      IsEmpty ( DecomissionDate ) ;

       

      Get(CurrentDate)  ; DecomissionDate

       

        )

       

      - CommissionedDate

       

      Month_Length:

      Case(

      Month(CommissionedDate) = "1"; "31" ;

      Month(CommissionedDate) = "2" ; "28" ;

      Month(CommissionedDate) = "3" ; "31" ;

      Month(CommissionedDate) = "4" ; "30" ;

      Month(CommissionedDate) = "5" ; "31" ;

      Month(CommissionedDate) = "6" ; "30" ;

      Month(CommissionedDate) = "7" ; "31" ;

      Month(CommissionedDate) = "8" ; "31" ;

      Month(CommissionedDate) = "9" ; "30" ;

      Month(CommissionedDate) = "10" ; "31" ;

      Month(CommissionedDate) = "11" ; "30" ;

      Month(CommissionedDate) = "12" ; "31"

      )

       

      Final Script:

       

      Time_Lapsed:

      (Int(

        Number_of_Days / 365.25 )) &

      " Years " & If(

        (Round( Mod( Number_of_Days ; 30.4375 ) ; 0 )) <=

       

        Month_Length and ((Int(Number_of_Days / 30.4375) ) ) < "1" ; "0" ;

       

        ((Int(Number_of_Days / 30.4375) - (12 * (Int( Number_of_Days / 365.25 )))))

        )

      & " Months " & (Round( Mod( Number_of_Days ; 30.4375 ) ; 0 )) & " Days"

       

      Script Reference:

      http://help.filemaker.com/app/answers/detail/a_id/870/related/1

       

      Issue:

       

      If I have a date of 12/06/2015 , the Lapsed time shows 1 years, 0 Months, 2 Days.

      It is currently 12/07/2016 which should make it 1 Day not 2...

       

      Any thoughts would help greatly.

       

      Thank you all.