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

Calculate the days between two dates in a third field

Avatar

Avatar
Boost 1
Level 1
Delano29
Level 1

Like

1 like

Total Posts

7 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
Delano29
Level 1

Like

1 like

Total Posts

7 posts

Correct Reply

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

18-08-2016

Hi,

I am using Adobe Livecycle Designer ES4.  I am making a travel form for my company.  The form has two date fields “BeginDate” and “EndingDate”.  I would like to calculate the days between the two dates in a third field called “TotalDaysOfTravel”.  I would also like to have something setup that if the employee choses a date in the  “BeginDate” field that is later than the one in the “EndingDate” field that it would give a warning “The ending date is earlier than the beginning date.”  The field should be setup to calculate the “TotalDaysOfTravel” automatically if anything in the two date fields change.

Could someone help me set this up?

Thanks.

Accepted Solutions (0)

Answers (1)

Answers (1)

Avatar

Avatar
Coach
MVP
radzmar
MVP

Likes

394 likes

Total Posts

2,686 posts

Correct Reply

490 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile

Avatar
Coach
MVP
radzmar
MVP

Likes

394 likes

Total Posts

2,686 posts

Correct Reply

490 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile
radzmar
MVP

23-08-2016

This isn't that complicated.

In the field "TotalDaysOfTravel" add the following FormCalc script in the calculate event:

var datePattern = "MM/DD/YYYY" /if neccessary change the pattern to the format you use to display your dates

var startDate = Date2Num(BeginDate.formattedValue, datePattern)

var endDate = Date2Num(EndingDate.formattedValue, datePattern)

var numOfDays = endDate - startDate +1

$ = numOfDays