3 Replies Latest reply on Oct 15, 2009 11:16 AM by Sgt. Cole

Time Calculations - Help please - time to hours

First of all I am a newbie......so be gentle with me

Doing a timesheet and I want it to calculate total hours from user entered start time and end time fields.  I can usually figure these things out if I can look at a sample.  Anyone have a sample timesheet they could send me for LiveCycle Designer that I can look at?

I am using FormCalc / Time2Num.

• 1. Re: Time Calculations - Help please - time to hours

Don't have a sample timesheet but you're on the right track.  Time2Num converts the entered time into the number of milliseconds since Jan 1, 1900.  Once you have both the start and end time in common milliseconds you can subtract one from the other to get the difference in milliseconds.  After that you can divide that down to get hours (1000 ms in one second, 60 seconds in a minute, 60 minutes in an hour, divide by (1000 * 60 * 60) to get hours.

Note that this will give you a decimal number of hours:  3:35:00 AM - 1:00:00 AM = 2.5833333 hours.  You'll have to be a bit fancier in your math to get hours/minutes/seconds.  I don't know what your actual requirements are.

Are you OK with script or do you need an example of this?

• 2. Re: Time Calculations - Help please - time to hours

The decimal number of hours is fine although I would like it to round to two places after the decimal (2.58).  I am VERY new at script so an example would be great if you don't mind.  Thank you so much.

• 3. Re: Time Calculations - Help please - time to hours

Lisa may not need a sample but I do.

I too am a newbie.  I'm also not a programmer or a designer.

I need tons of samples of everything or some very complete tutorials.  The stuff included with LiveCycle just doesn't do it for me.

I have several forms that would benefit from time calculations.  To be honest, I still need help with time formatting.  I've manage to get the Time object to display the current time, but User input has to be perfect or there's all kinds of messages.

Also, is there a way to count the selections from a Drop-Down List Boxes?

Is there a good book you can recommend?

Thanks!

Cole