Acrobat 7: LiveCycle Designer- Calculating Hours From Two Time Fields

I am designing a form for scheduling employees that has two fields, 'In', and 'Out'. A third field is used to calculate the difference in hours(example: 1.75 hours). I am having trouble getting the calculation to return hours instead of a pure number. When 'In'= 11:30 and 'Out'=12:30, for example, the difference is shown as '100', instead of '1'. Is there a way to accomplish what I need for this form?  Thank you.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Karl Heinz KremerCommented:
What do you get for e.g. in=11:00 and out=12:35 ?

How are you calculating the diffrence?
frizzellAuthor Commented:
The time fields are 'In' and 'Out'. In the 'Hours' field, where I want the hours worked to be calculated, I use  'Out - In', using FormCalc. So, if Out='12:25' and In='11:00', the 'Hours' total shows as 135 instead of 1:35. If Out=5:00pm and In=11:00am, the Hours total shows as 600. The user enters the time in 24-hour format, ex: 1300 = 1pm. Thank you for your time.
Karl Heinz KremerCommented:
If you are interested in the number of hours, use something like this:

var difference = IsoTime2Num(Out) - IsoTime2Num(In);
difference / 1000 / 60 / 60;

The IsoTime2Num() function will convert the time (in 24h format) to milliseconds since the "epoch", so the subtraction of out and in times will leave you will milliseconds. The second line converts this value to hours.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
frizzellAuthor Commented:
Thank you very much for the answer. It was EXACTLY the functionality that I needed. The speed and accuracy of your solution impressed me.
Very nice code.

The IsoTime2Num() function will convert the time (in 24h format) to milliseconds since the "epoch",
what if i want to convert the time in 12h format?
how will i go about it.

Thank you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Acrobat

From novice to tech pro — start learning today.