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
BedrockMission!

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

Avatar
Boost 1
Level 1
dennisd44138672
Level 1

Like

1 like

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
dennisd44138672
Level 1

Like

1 like

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile
dennisd44138672
Level 1

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)

Avatar

Avatar
Validate 1
Level 4
jasotastic81
Level 4

Likes

35 likes

Total Posts

329 posts

Correct Reply

43 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Validate 1
Level 4
jasotastic81
Level 4

Likes

35 likes

Total Posts

329 posts

Correct Reply

43 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile
jasotastic81
Level 4

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)

Avatar

Avatar
Boost 1
Level 1
dennisd44138672
Level 1

Like

1 like

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
dennisd44138672
Level 1

Like

1 like

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile
dennisd44138672
Level 1

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