Highlighted

Add 5 minutes to a time

New Here ,
Oct 21, 2020

Copy link to clipboard

Copied

I have a textbox that holds a time like "1:00 pm". I have another textbox below that I want to display 5 minutes added to the first box (1:05 pm). I've been looking through multiple forums trying different code, but the second text always displays "Invalid Date5". Here is the code I am using.

 

var dater = "1/1/2020" + " " + this.getField("Start1").value  

var previousDate = util.scand("m/d/yyyy h:MM tt", dater);

previousDate.changeBy({"minutes": 5});

event.value = util.printd("m/d/yyyy h:MM tt", previousDate);

I'm very basic in Javascript so any suggestions or help would be appreciated. Thank you! 

TOPICS
Acrobat SDK and JavaScript, How to

Views

16

Likes

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

Add 5 minutes to a time

New Here ,
Oct 21, 2020

Copy link to clipboard

Copied

I have a textbox that holds a time like "1:00 pm". I have another textbox below that I want to display 5 minutes added to the first box (1:05 pm). I've been looking through multiple forums trying different code, but the second text always displays "Invalid Date5". Here is the code I am using.

 

var dater = "1/1/2020" + " " + this.getField("Start1").value  

var previousDate = util.scand("m/d/yyyy h:MM tt", dater);

previousDate.changeBy({"minutes": 5});

event.value = util.printd("m/d/yyyy h:MM tt", previousDate);

I'm very basic in Javascript so any suggestions or help would be appreciated. Thank you! 

TOPICS
Acrobat SDK and JavaScript, How to

Views

17

Likes

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
Oct 21, 2020 0

Have something to add?

Join the conversation