These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Time sheets

dsl
Registered: May 27 2010
Posts: 2

I am having difficultly with creating a time sheet
User inputs time (in and out) and I want it to convert time to numbers and have it show fraction hours (less then an hour) as .25, .50 and .75 and then subtotal it as hours worked. (ie 8.25)
Then I need to subtract any comp time earned and add any comp time, sick, vacation or holiday used and then total as paid hours

I am having difficulty in figuring the script to convert time to numbers and them showing as .25, .50 ect.

I am using Acrobat 9 Pro

thanks for any help

My Product Information:
Acrobat Pro 9.3.1, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
How is the user entering the time? Do you convert it to a Data object? Which code have you written so far?
You need to provide some more information if you want any help.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
The time numbers are character strings, so it is possible to search the string for the ':' separator and obtain the hours and minutes as individual values and then convert the 2 values to minutes. Then you can easily perform the computations with minutes. And one can easily convert the minutes back to hours and minutes and format them into the correct character string. The exact scripts will depend on what program you are using and how your time string is formatted.

Once you get to the total minutes the formatting of the output can be done with JavaScript:
function FormatMinutes(TotalMinWorked) {// compute time worked as hours and decimal of an hourreturn TotalMinWorked == 0? "" :  util.printf("%,03.2f", TotalMinWorked/60);} // end FormatMinutes

or
function FormatMinutes(TotalMinWorked) {// compute time worked as hours:minutesvar MinWorked = TotalMinWorked % 60; // Minutes worked less than 1 hour (Modulos 60)var HrsWorked = Math.floor((TotalMinWorked - MinWorked) / 60); // Hours worked integer of minutes / 60return TotalMinWorked == 0? '' : HrsWorked + util.printf(":%,302.0f", MinWorked); // format output} // end FormatMinutes

George Kaiser