Expand my Community achievements bar.

SOLVED

Is this possible?

Avatar

Level 3

I have 2 fields startDate and endDate both have field type of date/time with calendar dropdown. Then i have a text field named RestrictedDays.

Is there anyway that it can take the date of startDate and endDate and tell me how many days in between and have it show up in RestrictdDays?

I found a script yesterday on the forums and cant get anything to work.

Can someone give me step by step of how to do this??

1 Accepted Solution

Avatar

Correct answer by
Level 7

the basic script (in formcalc) is:

$ = Date2Num(endDate.formattedValue, "DD/MM/YYYY") - Date2Num(startDate.formattedValue,"DD/MM/YYYY") // the DD/MM/YYYY part should be whatever format you have set your date fields to.

You put this script in the calculate field of the textbox. You may want to put in some extra code so you dont see a number until they have entered dates into both start and end date fields.

View solution in original post

6 Replies

Avatar

Former Community Member

If you look at this post I attached a sample that shows an example of a calculation between two dates.

http://forums.adobe.com/message/3262526#3262526

Paul

Avatar

Level 3

Hi Paul:

I dont know if your example would work for me. I am attaching a screen shot to show you the form..

I dont want to use a button to calculate but rather select start and end and then in field RestrictedDays show the total number or days.

form.png

Avatar

Level 7

You can use (in formcalc) the Date2Num function to turn your dates into numbers which you can then subtract the end date from the start date to get the number of days in between. You could put that calculation into the restrictedDays field so it will calculate automatically without the need for a button.

Avatar

Level 3

thats exactly what i want to do. Now the hard part how??


I dont know how to write that script.. Any idea?

Avatar

Correct answer by
Level 7

the basic script (in formcalc) is:

$ = Date2Num(endDate.formattedValue, "DD/MM/YYYY") - Date2Num(startDate.formattedValue,"DD/MM/YYYY") // the DD/MM/YYYY part should be whatever format you have set your date fields to.

You put this script in the calculate field of the textbox. You may want to put in some extra code so you dont see a number until they have entered dates into both start and end date fields.

Avatar

Level 3

Wow thank you so so mcuh... That did it