Copy link to clipboard
Copied
Hi
This is for a basic time sheet which calculates total time driving and total time on site. The column names are 'leave home', 'at depot', 'on site', 'off site', 'left depot', 'at home'.
All the fields are set to a HH:MM time format. How do i run a custom calculation which will deduct one field from another to give a result in hours?
For example, how would i calculate the time left home and arrived at depot, plus the time left depot and arrived at home in hours?
Likewise, I need to calculate the time on site and the time off site in hours)
Sometimes the drivers will go straight to site, in which case, if the 'at depot' field is blank, i need to calculate the time in hours driving from home to site and site to home.
Secondly, is there a way of time stamping when the entries were made?
much appreciated!
Copy link to clipboard
Copied
Have you looked at any of the tutorials linked to in these forums?
Some of the basics about formats. The displayed values are not always that same as the JavaScript value of the field. For example the Social Security Number appears as "99-99-999" but has a value in JavaScript of 999999999.
Have you been able to work out manually how to perform the calculations?
Will the time sheets cover leap years, and the dates and times of time changes?
JavaScript has the Date object that maps each date and time combination to a unique value. So it is possible to use numeric values to perform the calculation. This value also adjust for leap years, time zones, and time changes automatically.
Copy link to clipboard
Copied
HI - yes, I have looked at the tutorials, but it is all a bit over my head!
The breakdown of the formulae I am trying to achieve is:
X+Y+Z+W = Total time worked (ie the total time they were either at the depot or on site to the point they were at home
'Off Site' - (minus) 'On Site' = X
'At Depot' - 'Leave Home' = Y
'At Home' - Off Site' = Z
'At Home - 'Left Depot' = W
The struggle is trying to convert the numbers into hours as they all get paid an hourly rate.
The dates don't matter as much as it is all on a daily basis and the number of minutes in an hour stays he same throughout time.
There may be another way of calculating 'number of hours driving' and 'number of hours on site' by changing the layout of the time sheet. I am open to the idea of this!
Hope that all makes sense
cheers
Copy link to clipboard
Copied
If you're interested, I've developed a tool that allows you to set up exactly this kind of calculations very easily. You can purchase it from here: Custom-made Adobe Scripts: Acrobat -- Calculate Time Differences in a Worksheet
Find more inspiration, events, and resources on the new Adobe Community
Explore Now