Answered
I am having some problems with figuring out the formula for a timesheet.
If an employee puts in box 1 that they worked 1 hour and 30 minutes
then in box 2 they worked 1 hour and 30 minutes, I need the total hours worked to come out to 3 hours.
I hear it's hard to do this with a date/time box, is there a way for me to tell a numeric box to enter time as a decimal and to round .59 minutes to 1.00?
If so how do I do that?
1. parsing the formatted string for the hours and minutes information,
2. Converting this in to seconds.
3. Adding up the seconds for all the fields
4. dividing total seconds by 3600 to get Total hours.
5. Keep the remainder seconds and divide it by 60 to get minutes
If you need to deal with weeks or dates, then you'll need to use the JavaScript Date object
Working with dates and times is pretty easy if you know how it all works. See this artical. It has several sample files.
http://www.acrobatusers.com/tech_corners/javascript_corner/tips/2006/date_time_part1/
The files are not LiveCycle forms, but the time calculations are the same for all JavaScript, regardless of the environment.
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script