Skip to main content
Participant
July 6, 2020
Question

Timesheet

  • July 6, 2020
  • 2 replies
  • 410 views

Hi, I am very new to calculating the fields in an Adobe DC document that takes a time of arrival and departure plus a field for total breaks.

 

I have found this script:

function getTimeInterval(startTimeMon, endTimeMon, lunchTimeMon){
var start = moment(startTimeMon, "HH:MM");
var end = moment(endTimeMon, "HH:MM");
var minutes = end.diff(start, 'minutes');
var interval = moment().hour(0).minute(minutes);
interval.subtract(lunchTimeMon, 'minutes');
return interval.format("HH:MM");
}

but it doesn't display any results in the total hours worked field.

I need to do this for a two week period and then calculate the total hours for all days worked.

 realise that I will need to add to the script, but i don't want to over complicate things to start with.

Any help would be appreciated, please.

Many thanks

This topic has been closed for replies.

2 replies

try67
Community Expert
Community Expert
July 7, 2020

This code will not work in Acrobat. You should search the forums, this issue was discussed here many times and (working) code samples have been provided.

 

If you don't want to mess around with writing the code yourself you can use this (paid-for) tool I've developed to set it up in seconds: http://try67.blogspot.com/2011/03/acrobat-calculate-time-differences-in.html

Bernd Alheit
Community Expert
Community Expert
July 7, 2020

Where have you found this function?

alan923Author
Participant
July 9, 2020

Hi Bernd_Alheit,

it was on another forum, but before i had discovered this one.

Bernd Alheit
Community Expert
Community Expert
July 9, 2020

This looks like a script for a other software produvt.