• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Add 1 min to time field with HH:MM format

New Here ,
Nov 13, 2020 Nov 13, 2020

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.

 

TOPICS
Acrobat SDK and JavaScript

Views

796

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Nov 13, 2020 Nov 13, 2020

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);
}

Votes

Translate

Translate
Community Expert ,
Nov 13, 2020 Nov 13, 2020

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);
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 13, 2020 Nov 13, 2020

Copy link to clipboard

Copied

LATEST

This worked like a charm! Thank you very much.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines