Answered
I am trying to create a PDF in Acrobat Pro to calculate Time Elapsed in an Hours:Minutes format. For example 1:00 - 2:30 = 1:30. I have three fields: "Start Time", "End Time", "Total Time". I want the calculation to go into the "Total Time" field.
I have no programming experience and really have no idea what i am doing. Any help will be greatly appreciated. I can email the form to anyone willing to help. Thanks.
sTime = this.getField("Start Time").value;
eTime = this.getField("End Time").value;
if (sTime!="" && eTime!="") {
sTimeHours = sTime.split(":")[0];
sTimeMinutes = sTime.split(":")[1];
eTimeHours = eTime.split(":")[0];
eTimeMinutes = eTime.split(":")[1];
tTimeHours = eTimeHours - sTimeHours;
tTimeMinutes = eTimeMinutes - sTimeMinutes;
if (tTimeMinutes<0) {
tTimeHours--;
tTimeMinutes = 60 + tTimeMinutes;
}
tTime = tTimeHours + ":" + tTimeMinutes;
event.value = tTime;
} else event.value = "";
- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com