Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

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

Avatar

Level 1

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.

0 Replies

Avatar

Level 7

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)

Avatar

Level 1

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.....