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

    Can I calculate the number of days between two dates (example: Today mi

    Asked by demnos on May 02, 2014 at 03:35 AM

    Can I calculate the number of days between two dates (example: Today minus a date from my form)?



    This is a re-post of a comment on How to Perform Form Calculation Using a Widget

    two dates between two dates
  • Profile Image
    JotForm Developer

    Answered by ceren on May 02, 2014 at 04:14 AM

    Hi demnos,

    You can achieve your requirement with using our Form Calculation widget.

    First you need to add 2 date fields to your form. Then add Form Calculation widget and configure it to calculate the number between two dates. 

     

     

    If you want to calculate the difference between today and the other date field you can set first date field’s value to default and hide it. This will set date field value to today and it will never be seen on your form. 

     

     

    You can find additional information about Form Calculation widget here.

     

     

    If you have any other questions, please let us know.

  • Profile Image

    Answered by demnos on May 03, 2014 at 05:29 PM

    I'll give this a try.  Thanks!

  • Profile Image

    Answered by demnos on May 03, 2014 at 05:47 PM

    Ok, so this calculation isn't working.

    I tried to calculate May 3, 2014 (today) - May 1, 1981 I get an answer of 4212.7.  What does this number represent?  It isn't days because if you divide it by 365 (days in a year) you get 11.54 when I would expect something around 33 years.  Do you know how this application handles dates?

  • Profile Image
    JotForm Support

    Answered by Welvin on May 03, 2014 at 09:51 PM

    You have to disable the TIME in the DateTime field so to have the correct days. To disable, simply click on the "Allow Time" button:

     

     

    Example Form: http://www.jotformpro.com/form/41228066850958

    If you require any further assistance, feel free to contact us.

    Thanks

  • Profile Image

    Answered by demnos on May 03, 2014 at 10:14 PM

    Got it working then.  Thanks.

    I was using the Birthday Picker instead of the plain DateTime picker.  :-(

  • Profile Image

    Answered by himanshugogia on May 10, 2016 at 08:50 AM

    Hey,

     

    I need to calculate number of days between two dates and the result shown should exclude Saturday and Sunday.

     

    Please suggest if its possible?

  • Profile Image
    JotForm Support

    Answered by KadeJM on May 10, 2016 at 11:02 AM

    @himanshugogia

    You've posted a follow up question so I have moved it to this thread over here. Even though it's partly related we ask in the future you please open up new questions you have via a new thread.