Hello forum,
I makin a new form that has two calendar dates.
The first date is a start date
The second is an end date
After the dates are selected a text box will generate the number of days.
How could I accomplish this.
I'm desperate for help, my form is ready for presentation and I've tried to find a solution and I'm at my deadline.
Thank You so much forum!
Solved! Go to Solution.
Hi,
I would recommend using FormCalc for anything to do with dates. The process is fairly straight forward, you convert each date to a number and subtract them. In the script I have wrapped the calculation in an if statement to check that the dates are correct first:
if (startDate == null or finishDate == null ) then
$ = null
elseif (startDate > finishDate) then
xfa.host.messageBox("Please check the start and finish dates, as there appears to be an error", "Dates")
$ = null
else
$ = Date2Num(finishDate, "YYYY-MM-DD", "en_IE") - Date2Num(startDate, "YYYY-MM-DD", "en_IE")
endif
Good luck with the presentation,
Niall
Hi,
I would recommend using FormCalc for anything to do with dates. The process is fairly straight forward, you convert each date to a number and subtract them. In the script I have wrapped the calculation in an if statement to check that the dates are correct first:
if (startDate == null or finishDate == null ) then
$ = null
elseif (startDate > finishDate) then
xfa.host.messageBox("Please check the start and finish dates, as there appears to be an error", "Dates")
$ = null
else
$ = Date2Num(finishDate, "YYYY-MM-DD", "en_IE") - Date2Num(startDate, "YYYY-MM-DD", "en_IE")
endif
Good luck with the presentation,
Niall
Awesome formula and easy to use.
Thanks a million.
Arnold Love
Views
Replies
Total Likes
There is any way the script does not calculate Saturdays and Sundays?
Thanks
Views
Replies
Total Likes
Views
Replies
Total Likes