How do I calculate the difference between todays date and a date set in the future that is hidden in the form?

  • Profile Image
    Asked on March 16, 2015 at 05:07 PM

    I am trying to calculate how many days there are from the day the customer sees my form to 02/11/2015 2nd november which will remain hidden. How can I modify the script to allow me to change and set this date? 



  • Profile Image
    Answered on March 16, 2015 at 07:47 PM

    Hi Ryan,

    If you check this JotForm Calculate Number of Days template, you will see how it calculates the number of days between 2 dates.

    As you can see, it will be simple to calculate the days difference between two dates using the Date field.

    BUT if I am not mistaken, from what I understand on your description, you wanted the future input date to be hidden on the form?

    In your form, the user should not be able to manually input the future date?

    Can you please clarify first if my understanding of the procedure is correct.

    We will provide with you with the applicable solution when this is clear.




  • Profile Image
    Answered on March 16, 2015 at 08:41 PM

    Yes that is correct, I need the future input date to be hidden

    Awesome thankyou 

  • Profile Image
    Answered on March 16, 2015 at 10:31 PM

    You can achieve this by following these steps:

    #1. Add a hidden DateTime field on the form.

    #2. Create the needed Calculation between 2 dates.


    #3. Make sure first the calculation is working as needed. The fields can be hidden also using the Hide Property




    the question now is.. how will you be able to fill-in the future dates if it is hidden on the form?


    #4. You can pre-fill the hidden Date (future date input) using the pre-populate URL method.

    user guide: -Prepopulating-fields-to-your-JotForm-via-URL-parameters


    You can test my demo form. I have hidden the future Date and show only the Total Days so that you can see the calculation.[month]=05&futureDate[day]=23&futureDate[year]=2015

    Hope this help. Let us know if you need further assistance.

    Let us know if this solution work.. or not.