Expand my Community achievements bar.

Time Calculations. PLEASE HELP (2)

Avatar

Former Community Member
Need to know the script to use for calculating Time via FormCalc.



Is there an area where someone could go to find SAMPLES of things like and employee time sheet. There is one with the product but its to basic (I need something that can calculate how much time between 8:10 am and 5:15pm and perhaps a lunch hour (1:00).



I have sinced paid $159 for product support that has turned out to be totally fruitless. Was told that Adobe could help with "anything" I had to ask..... concerning the product.



If there is ANYONE out there who can help - please do so. I would be eternally gratful.



Meggie
8 Replies

Avatar

Former Community Member
Here's an example of some Formcalc that will return the number of hours between 8:10am and 5:15pm:



(Time2Num("5:15:00 PM") - Time2Num("8:10:00 AM")) / 3600000



The 3600000 converts the miliseconds to hours.



Chris

Adobe Enterprise Developer Support

Avatar

Former Community Member
This brings me a little closer; however, I want the formular to calculate a field that the user enters 8:10 am / 5:15 pm



I tried something like this but it obvioulsy did not work.



(Time2Num("Field1") - Time2Num("Field2")) / 3600000



**I am a newbie to all of this so please be patient**



Any ideas?

Avatar

Former Community Member
Do you happen to have the full FormCalc specification? May be useful when refering to the Time2Num / Num2Time functions.



http://partners.adobe.com/public/developer/en/xml/formcalc_2.0.pdf

Avatar

Former Community Member
Ok, it's going to depend. What kind of fields are you using for the form fields that the user enters the times in? And what format does the user enter the time in?



Chris

Adobe Enterprise Developer Support

Avatar

Former Community Member
Time/Date Fields (h:MM A pattern) , the user can type EACTLY "8:10 am" and the field I am using to Calculate is also Time/Date (h:MM A pattern).

Avatar

Former Community Member
Ok, I attached a quick sample. Few things to notice:



- On the Date/Time fields I set the data format to Time and teh Edit Pattern to h:MM A

- I did not use a Date/Time field for the total, I used a text field. There is not point in using a Date/Time since you are using the field to show a number of hours and minutes not a date or time. And the formatting that the Date/Time field does will make things much more complicated.

- You can see the script on the calculate event of the text field.



Chris

Adobe Enterprise Developer Support

Avatar

Former Community Member
This is awesome. My only issue now is converting the result (instead of showing 21:45, I would like it to show 9:45).

Avatar

Former Community Member
I have tried this and when ever using zero i cant get a return value. IE time in 10:00 AM time out 11:00 AM is there is simple way of doing this? Basically i need to create a form that i can use as a time card. Actual time in and actual time out giving me the total hours worked. No breaks in between.