Copy link to clipboard
Copied
could someone point me in the right direction with the javascript code that I would put into a buttons actions to calculate 30 days from "date" field and output it to a field called "first_payment_date"
Copy link to clipboard
Copied
One of the problems with dates is that they can be formatted in a lot of different ways. So, in order to calculate a future date, the date string in the field has to be converted to a Date object, which means you have to know the format of the date up front.
For the code below the date is assumed to be in the standard dd/mm/yyyy format. You'll need to modify this for your particular form.
var strDate = this.getField("date").value;
if(strDate != "")
{
var dtStart = util.scand("dd/mm/yyyy",strDate);
var dtNext = new Date(dtStart);
dtNext.setDate(dtStart.getDate() + 30);
this.getField("first_payment_date").value = util.printd("dd/mm/yyyy",dtNext);
}
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more