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

Calculating hours worked on a timesheet

suei
Registered: Jan 29 2008
Posts: 9

I need my timesheet to calculate hours worked (to the quarter hour) using a 12 hour clock rather than 24 hour clock. I am using Pro 8 livecycle designer and will understand formcalc more because I haven't learned javascript.

Staff will enter In and Out times for am and pm on their timesheet.

Any resource info, tutorials, or answers will be greatly appreciated. I have searched the "answered" forums and didn't see a similar situation.

Thanks for all the help I have received from the forums.

Sue

My Product Information:
LiveCycle Designer, Windows
hiddengraphics
Registered: Mar 19 2008
Posts: 39
I do not use the program you use, but I believe a little javascript might do it. Something like var a= time(whatever units)
If var a>12
then var a=var a-12;

I have not used javascript in a long time, but the approach I suggested may work with some language cleanup
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
Time display is controlled by the using the appropriate "Display Format" for a date time field set for time Data Format.

Since the "rawValue" and "formattedValue" both return a string value for the time, you will need to use "Time2Num()" function to convert the time string into the number of milliseconds from LiveCycle Designer's Epoch date. You can now either convert this number into minutes for each field compute the difference or compute the difference of the two field and then convert the difference in milliseconds into minutes and format the resulting value into hours and minutes.

You might want to add hidden fields to keep the number of minutes for each day so the time period total is easier to compute.

George Kaiser