How do I add 6 or 12 weeks to date selected in a date field

dennisd44138672

19-06-2015

I have a datefield, holddate, that I want to add 6 or 12 weeks to, based on a radiobutton click, and display the new date in another datefield, restartdate.......

the holddate defaults to Date(), unless changed by the user.... formatted "MM-DD-YYYY"

my code looks like:

<event activity="click" name="event__click">

<script contentType="application/x-javascript">

var

dtToday = this.resolveNode("HoldDate").rawValue;

app.alert(dtToday);

var

intWkDate=Date2Num(form1.LabCoatOrder.HoldDate);

app.alert(intWkDate);

 

</script>

app.alert(dtToday); displays 2015-06-19

app.alert(intWkDate); this doesn't display..... haven't even tried adding 42 or 84 days yet!!!!! trying to determine the days from epoch so I can add the additional days.

Accepted Solutions (0)

Answers (2)

Answers (2)

jasotastic81

19-06-2015

First thing I notice is that your XML says you're using javascript, but Date2Num is FormCalc.

If you change to formcalc, you should be able to see your days from epoch value.

That said, your code would look something like this if you were setting the date value in dfWkDate to the day 42 days after dfHoldDate when the date is selected.

dfHoldDate::exit (formcalc)

dfWkDate = Num2Date(Date2Num($.formattedValue)+42)

dennisd44138672

19-06-2015

Can't believe that was my issue, I even indicated that I was using formcalcs in my tags....

Thank you very much - didn't want to take this issue into the weekend.....