3 Replies Latest reply on Jan 21, 2014 3:05 PM by gkaiseril

    Assistance with time tracking document


      I am working on a time tracking document, and I need to create a total on the first page of the document based on the selection of a drop down box and a total time field.


      Basically on the reverse side of the form, someone enters that they spent 15 mins on paperwork (drop down list number 3).  I then need to review all the entries on the reverse side of the form to add up all the time that the individual spent on 3 ie. paperwork, 2 telephone, etc.  (there are 30 rows).  I would want the the time to automatically fill into a simple chart on the front of the document. That chart will then have a total which would equal the amount of hours worked. 


      I'm new at adobe, and have tried a variety of ways to run it with no avail. I can accomplish it for a single box but can't get it to compute correctly when I add additional fields.   Is this possible?

      In addition, I need to have the time on the fill in portion of the form be in real time whereas the chart on the front needs to be changed to quarter hours, which I think I have figured out.


      entry on reverse                                                            chart on front

      Start      End     Total Time     Work Type                      Paperwork:     3.75

      08:00     08:15     :15               3                                    Telephone     2.00

                                                                                            Training:        2.25  



      Any suggestions would be appreciated. Thank you!

        • 1. Re: Assistance with time tracking document
          gkaiseril MVP & Adobe Community Professional

          Do you want the time computations doe in hours and minute or decimal hours?


          How do you want the results displayed?


          What is not not right with your computation?


          You illustration does not appear to be the result for the detail you provided.


          There are many examples of time sheets and time calculations in this forum.

          • 2. Re: Assistance with time tracking document
            mahnbg Level 1

            Thank you GKaiseril for your response. 


            I wanted the results in decimal hours.

            I have used the attached calculations, and it works perfectly with the exception for anything that that runs to or past 00:00. 

            This form will be used by public safety; therefore there is a good chance that they take an incident call at 11:45pm and it goes past the midnight hour.  From your other posts, you have indicated that there is a lot of script writing to be done before this happens.  Obviously, I don't have the capabilities to do this so I just wanted to double check with you before I try to figure out a work around.



            function Round(nValue, nPrecision) {

            // round a number a given precision

            return util.printf("%,101." + nPrecision + "f", nValue);

            } // end round



            function Time2Min(cFormat, sTime) {

            sTime = sTime.toLowerCase();


            // adjust for 12:MM am

            if( (cFormat == "h:MM tt" || cFormat == "hh:MM tt") && ( (sTime.substr(0, 2) == "12" && sTime.substr(6,1) == 'a') || (sTime.substr(0, 2) == "12" && sTime.substr(5,1) == 'a') ) )

               sTime = "00" + sTime.substr(2, sTime.length - 2);

            // convert a formatted time string to number of minutes since midnight

            // get time object

            var oTime = util.scand("mm/dd/yyyy " + cFormat, "01/01/1970 " + sTime);

            // convert to milliseconds

            var nTime = oTime.getTime();

            // convert to milliseconds to minutes and return value

            nTime = nTime / (1000 * 60);

            // return round to whole minutes

            return Number(Round(nTime, 0));

            } // end Time2Min


            function TimeDiff(cFormat, cSTARTRow, cENDRow) {

            var nDiff = 0;

            // get the value of the time in and out fields

               var sOut = this.getField(cENDRow).value;

               var sIn = this.getField(cSTARTRow).value;

               // compute if we have both values

               if(sOut != "" && sIn != "") {

                  // convert time string to minutes and compute difference

                        nDiff = Time2Min(cFormat, sOut) - Time2Min(cFormat, sIn);

                  // convert to hours

                  nDiff = nDiff / 60;

               }   // end if sOut & sIn

               // return rounded value 

               return Round(nDiff, 2);




            individual field

            var cIn = "STARTRow.1", cOut ="ENDRow1";

            event.value= TimeDiff(HH:MM",cIn, cOut;:

            //convert zero entry to null

            if (event.value ==0)event.value ="";


            Thank you.

            • 3. Re: Assistance with time tracking document
              gkaiseril MVP & Adobe Community Professional

              the JavaScript date object covers both date and time. Time without a date reference is not always a useful peice of data, especially on the days daylight savings time becomes activer or inactive.


              You will have to add additional coding to include the date.


              Also you might want to include the timezone offset of the UTC time value.