4 Replies Latest reply on Oct 9, 2011 1:59 AM by ajmayjnr

# Another Date Calculation Question.

Hi All,

OK, this is a continuation from here: http://forums.adobe.com/thread/906583  Basically, I need to change the form a little and therefore need a continuation of that threads result.

Short version - I need to take a future date which is calculated by taking a result of a drop down (0-13) and using this script finding a day in the futue:

var f = this.getField("BILLINGCYCLEDATE");

var g1 = this.getField("DAYS");

var g = g1.value

var today = new Date();

add +=1000 * 60 * 60 * 24 * g;

f.value = util.printd("mm/dd/yyy", future);

Basically it adds a number of days to today and giving a result.

What I need to do is take that result, add another number of days (0-13 again) to give a new date.... and I am struggling to get a result at the moment.

So here is a real workd scenario:

How many days from today will the contract start?  (option 0-13 days) = RESULT A.

How many days from RESULT-A will first payment be due (option 0-13) = RESULT B.

Does that make sense?

Ant

• ###### 1. Re: Another Date Calculation Question.

add the same script to the new field but add the following (payday is the next 0-13 field)

var n1=this.getField("PAYDAY");

var n=n1.value

and change the add+ field to

and finally change billingcycledate field  to reference the new payday date field.

• ###### 2. Re: Another Date Calculation Question.

Hi Mate,

OK, this gave me a result... but it was a result of X number of days from today (rather than from the result of "RESULT-A"

Here is what I placed in as my script.

var f = this.getField("DirectDebit_Start");

var g1 = this.getField("Daysuntilstart");

var g = g1.value

var n1=this.getField("MembershipDaysTillBilling");

var n=n1.value

var today = new Date();

f.value = util.printd("dd mmmm yyyy", future);

Any thoughts on where I am going wrong?  I have tried doing a few different things but I either get no result or I get X days from today's date.