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

    How can I calculate difference between two dates in Days, months, and years?

    Asked by smai on October 24, 2016 at 09:33 PM

    Is there a magic formula to make this happen?

    I am trying to create a Warranty Claim form, where the customer inputs the date purchased.

    This will then (hopefully) auto-calculate the period lapsed since purchase in another text box field.



    Time lapsed = 3 years, 2 months, 1 day

    = 2 months, 5 days

    = 29 days etc. etc.


    The magic calculator doesn't do 'IF' formulas does it?

  • Profile Image
    JotForm Support

    Answered by Chriistian on October 25, 2016 at 12:32 AM

    You can use the Form Calculation widget to calculate the difference between two dates. 

    1. First, add the form calculation widget.

    2. Then input the formula seen below. Here's a guide that can help: How to Perform Calculation in the Form?

    The result should be the number of days since the purchased date.

    For months, simply add another Form Calculation widget and add the formula below:

    Here's the result:

    You can also clone my demo form to test it and see it in action here: https://form.jotform.com/62980617429970.

    If you need further assistance, please let us know.