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

Adding days to a date

Avatar

Avatar
Validate 1
Level 1
treesRansw
Level 1

Likes

0 likes

Total Posts

8 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
treesRansw
Level 1

Likes

0 likes

Total Posts

8 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
treesRansw
Level 1

22-08-2013

I can't get my code to work, I've read over most of the other posts regarding Adding days to a date, and I'm can't figure out why my code isn't working.

Date1 field is a Date/Time field: I want the user to select a date

Date2 field is a field that I would like a new date (Date1 + 21 days) to automatically populate.

Here is my code, it is set to run when the user exits Date1.

var Date1 = Date2Num ($, "yyyy-mm-dd")

Date2 = Num2Date (Date1 + 21, "yyyy-mm-dd")

The result is y-m-d in the Date2 field. I have tried making Date2 a text field, numeric field, and another Date/Time field, the result is always the same.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 10
Level 2
ndjustin20
Level 2

Like

1 like

Total Posts

60 posts

Correct Reply

2 solutions
Top badges earned
Validate 10
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Validate 10
Level 2
ndjustin20
Level 2

Like

1 like

Total Posts

60 posts

Correct Reply

2 solutions
Top badges earned
Validate 10
Validate 1
Boost 1
Affirm 1
View profile
ndjustin20
Level 2

23-08-2013

I just sent it back.  I was having some issues getting it to work according to the docs and how I recommended.  Here is the code I used to get it to work properly.  I used the ISO and manipulated the date from there.

var dateNumber = IsoDate2Num($)

topmostSubform.Page1.GerminatorDate.rawValue = Num2Date(dateNumber + 21)

Answers (4)

Answers (4)

Avatar

Avatar
Validate 1
Level 1
treesRansw
Level 1

Likes

0 likes

Total Posts

8 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
treesRansw
Level 1

Likes

0 likes

Total Posts

8 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
treesRansw
Level 1

22-08-2013

Email is coming your way

Avatar

Avatar
Validate 10
Level 2
ndjustin20
Level 2

Like

1 like

Total Posts

60 posts

Correct Reply

2 solutions
Top badges earned
Validate 10
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Validate 10
Level 2
ndjustin20
Level 2

Like

1 like

Total Posts

60 posts

Correct Reply

2 solutions
Top badges earned
Validate 10
Validate 1
Boost 1
Affirm 1
View profile
ndjustin20
Level 2

22-08-2013

Could you send me the form with a description of what you are looking for it to do?

ndjustin20 at hotmail dot com

Avatar

Avatar
Validate 1
Level 1
treesRansw
Level 1

Likes

0 likes

Total Posts

8 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
treesRansw
Level 1

Likes

0 likes

Total Posts

8 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
treesRansw
Level 1

22-08-2013

Both fields are FormCalc...though there is no formula in the Date2 field.

I used your formual and the result is still the same, only now the result is m/d/y.

Avatar

Avatar
Validate 10
Level 2
ndjustin20
Level 2

Like

1 like

Total Posts

60 posts

Correct Reply

2 solutions
Top badges earned
Validate 10
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Validate 10
Level 2
ndjustin20
Level 2

Like

1 like

Total Posts

60 posts

Correct Reply

2 solutions
Top badges earned
Validate 10
Validate 1
Boost 1
Affirm 1
View profile
ndjustin20
Level 2

22-08-2013

Hello,

Make sure you are using FormCalc as both Date2Num and Num2Date are FormCalc functions and NOT js functions.

Then use:

newDateField = Num2Date(Date2Num(dateFieldWithDateNeedingToChange, "MM/DD/YYYY") + 21, "MM/DD/YYYY")


Justin