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

    Form Calculation: How to add number of years instead of days in a date?

    Asked by commercialandlegal on October 29, 2014 at 01:18 AM
    expiry date date field and datestring
  • Profile Image
    JotForm Support

    Answered by ashwin_d on October 29, 2014 at 08:43 AM

    Hello commercialandlegal,

    The only function available to do the data calculation available in "Form Calculation" widget is "dateSrting()" where you can only add number of days. Unfortunately, within the form calculation widget, it is not possible to add number of years. You can calculate the number of days and then add 365 days to the date field to increase it by one year. 

    If you want to add the number of years in your expiry date, the only possibility I can think of is to download your form's full source code and add custom JavaScript to achieve your requirement. 

    If you google, you will get a lot of JavaScripts code to achieve your requirement. 

    Thank you!