Copy link to clipboard
Copied
Hi,
I do not know Javascript and would really appreciate if you can help me how I can autocalculate with adobe acrobat form. Here is what I want:
End time1 = 23:30 #this is in HH:MM format and should be entered manually
Start time2= 23:31 #this is in HH:MM format, should be autocalculated, and is equal to End time1 + 1 minute.
Thanks in advance.
Try this code as the custom calculation script of "Start time2":
var endTime = this.getField("End time1").valueAsString;
if (endTime=="") event.value = "";
else {
var d = util.scand("mm/dd/yyyy HH:MM", "01/01/2020 " + endTime);
d.setTime(d.getTime()+60000);
event.value = util.printd("HH:MM", d);
}
Copy link to clipboard
Copied
Try this code as the custom calculation script of "Start time2":
var endTime = this.getField("End time1").valueAsString;
if (endTime=="") event.value = "";
else {
var d = util.scand("mm/dd/yyyy HH:MM", "01/01/2020 " + endTime);
d.setTime(d.getTime()+60000);
event.value = util.printd("HH:MM", d);
}
Copy link to clipboard
Copied
This worked like a charm! Thank you very much.