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

Calculate Hours

abellad
Registered: Jul 8 2008
Posts: 7

I have read various posts about calculating time and date but my requirement is a bit different, I think. I'm using LiveCycle Designer 8.0

I have a form with numeric fields and users are asked to enter number of hours and minutes (to the nearest 15 minutes), at the end on this column I have a total column where I'm using Fromcalc to calculate total no. of hours using the SUM function.

What I'd like to do is calculate in hours rather that decimal numbers for e.g if a user enters 1.40 in a cell and then 1.30 in the next, the total should calculate to 3.10 (3 hours 10 minutes) rather than 2.70.

Any help would be appreciated. Thanks.

My Product Information:
LiveCycle Designer, Windows
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
Time does not add the same as base 10 numbers does. The Sum function is for summing decimal numbers. You need to convert the time values to decimal hours, do the math, and then convert the resulting decimal hours back into hours and minutes format.

Using the Time2Num function will provide the number of minutes, so one could use the minutes in the calculation and then just convert the minutes back to hours and minutes.

George Kaiser

abellad
Registered: Jul 8 2008
Posts: 7
Thanks for your reply!

I have figured our the math for this. I will have to divide the user entry by 60 add up the totals and then convert that total, which is a decimal number, into time format (ie number of hours and minutes). But I'm not sure how to go about this.

This is what I'm using at the moment in the total column.

form1.#subform[0].Body.TotalTaken[0]::calculate - (FormCalc, client)

Sum(Jan/60,Feb/60,Mar/60,Apr/60,May/60,Jun/60,Jul/60,Aug/60,Sep/60,Oct/60,Nov/60,Dec/60)

This calculates the inputs in a decimal format, but how do I convert the total sum in hours and minutes. The months in the script are my field names. Any help with this script would help to show me where I'm going wrong.

Thanks