What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    Calculate project periods based on end date minus start date

    Asked by HMSSPA on March 15, 2016 at 04:54 PM

    Hi,

    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.

    Page URL:
    https://www.jotform.com//?formID=60745166766162

    start date project date calculation
  • Profile Image

    Answered by Ben 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

  • Profile Image

    Answered by HMSSPA 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.

  • Profile Image

    Answered by Ben 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.