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

    Using Form Calculation to determine midway point between dates

    Asked by nperrone on February 13, 2015 at 12:47 PM

    Hello,

    I have two required date fields in my form that once completed, should populate a third date field which would be the midpoint between the two.

    The first required field is the date the form is submitted(we'll call it "A"), the second date is the date of my clients affair (call it "B").

    I've used the calculation wizard to successfully populate when the final payment is due (using datestring(weddingdate-14), but for the life of me, clearly lack the mathematical prowess to even know where to begin creating a formula that will take Date "A" and Date "B" and spit back the correct 2nd due date which would be the midpoint between "A" & "B"

    I've attached a partial clone of the relative info for the form I'm working on

    is this even possible???

    thank you in advance

    Page URL:
    http://form.jotform.us/form/50435509080147

    calculation wizard date field required field due date Form calculation
  • Profile Image

    Answered by Ben on February 13, 2015 at 03:06 PM

    Yes, it is possible, but we need to set it up correctly.

    First, this is the jotform where you can see it in action: http://form.jotformpro.com/form/50435994757974

    Now what I did here:

    You have mentioned that you want to get a middle date. It would be easier if it is a certain amount of days, but even with this we are able to use Form Calculation and have it all work for us.

    First it is important to note that if we take the 'bigger' date {field1} and subtract the younger (past) date {field2} we will get the number of days in between {x}.

    Based on how you set the jotform I believe you already know the rest, but I will still continue :)

    Now setting the number of days as {x} and the middle date as {y} the function to get it becomes:

    y = field1 - x or y = field2 + x

    Lets put it into graphics

    In our case, we took the wedding date and subtracted the half of the days in between.

    Now since today is 13th, I would recommend setting the wedding to 27th to see the middle as 20 (the quick check), but do feel free to make all sorts of checks to see how it works.

    Do let us know how it goes :)

  • Profile Image

    Answered by GerMurphy on February 13, 2015 at 03:22 PM

    Thanks Ben - think that might sort an issue I'm having too

  • Profile Image

    Answered by nperrone on February 13, 2015 at 04:14 PM

    brilliant! Thank you Ben. It works perfectly

  • Profile Image
    JotForm Support Manager

    Answered by Jeanette on February 13, 2015 at 04:19 PM

    I am very glad to see Ben's workaround helped not only one, but two Jotform users