- HMSSPAAsked on March 15, 2016 at 04:54 PM
I am trying to calculate the length of a project based on the user's selected start versus end dates. I have inserted Form Calculation widget, but I do not seem to be able to set it up properly. Ultimately, I need this calculation to show additional fields to see how much funding is requested per each project year and I have created conditions for that. Can you advise how to approach date calculation to come up with the length (which would be invisible to my users) of the project? Thank you.
- BenAnswered on March 15, 2016 at 05:51 PM
I would just like to confirm if you are looking to calculate a date in such way that you get days between two days? Then you would use the number of days to do further calculation - or do you need some other time interval like weeks, hours, etc.
If the first is true, then all you would need to do is to add 2 datetime fields to your form. Then in form calculation take the start date from the end date and you would get the number of days.
I have made a quick demo form for you to check here: https://form.jotform.com/60746561186966
If you wish, you can clone it to your account and inspect by following the steps here: How to Clone an Existing Form from a URL
- HMSSPAAnswered on March 16, 2016 at 10:13 AM
Yes, I am looking to calculate period (days) between two days. I made my calculation field invisible, and I believe that is why my conditional fields were not displaying. I went ahead and made the calculation field visible, and everything worked out perfectly. Thank you for a quick response, through.
- BenAnswered on March 16, 2016 at 11:05 AM
I took a look at your form and I see the setup. I do suggest setting up the dates to the current date - or some other date so both are starting their calculations right away.
That way there will not be the -16876 if they select current date.
You can do that by clicking on the default date option in the toolbar
Now I made a clone of your form and have hidden the field and it seems to do the same calculations as if it is shown.
You would however be able to check this and validate if the same are correct. This is the form: https://form.jotform.com/60753945962972
If you wish to keep the default date off and have the calculation work, you could also set the form calculation to calculate the fields only when both date fields are entered.
You can do that by clicking on Advanced options in the Form Calculation and then
Hope this helps.