4 Replies Latest reply: Jan 27, 2014 11:14 AM by federico cal RSS

    hour between 2 diferent date

      i have to different date.

       

      Create_date and Update_date

       

      I need calculate the time between this dates.

       

      I need to consider WORKINGDAYs to. and worktime is for 8 hours per day.

       

      example

       

      Create_date                              Update_date                              RESULT

      07/10/2013 6:54:13                   08/10/2013 17:59:19                  100:13:56

       

       

      At this RESULT I NEED APPLY WORKING DATE AND 8 HOURS PER DAY.

      ACTUALLY I USE.

       

       

      sum({< STAT = {"CLOSE"} >}Interval( (Update_date) - (Create_date), 'hh:mm:ss' ))

       

      Thanks regards

       

        • Re: hour between 2 diferent date
          Pradip Sen

          May be like:

          sum({< STAT = {"CLOSE"} >} Networkdays( Update_date , Create_date) ) * 8

          • Re: hour between 2 diferent date
            Jonathan Dienst

            Hi

             

            Perhaps something like this

             

            Sum((({<STAT = {'CLOSE'}>} Networkdays(Update_date ,Create_date)) - 1) * 8 +

            (Time#('17:00', 'hh:mm') - Frac(Create_date) + Frac(Update_date) - Time#('09:00', 'hh:mm')) * 24)

             

            The net work days calculates the working day inclusive of both dates, so we need to subtract 1 and apply 8 hours per day. The second part computes (in day fractions) the remaining time on the create date and the update date and is multiplied by 24 to convert to hours.

             

            HTH

            Jonathan

             

            Edit: Correction, I think that should read

             

            Sum({<STAT = {'CLOSE'}>} (Networkdays(Update_date ,Create_date) - 1) * 8 +

            (Time#('17:00', 'hh:mm') - Frac(Create_date) + Frac(Update_date) - Time#('09:00', 'hh:mm')) * 24)