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

    Comparing two dates in a calculation field occasionally produces a non whole number

    Asked by brooke833 on February 24, 2016 at 08:45 AM

    Hi I have a form setup to calculate the number of rental days that they are choosing to rent for.  For some reason occasionally it is not displaying a full number - ie. 5.96 days instead of 6 days - see the reservation confirmation below.  What would cause this?  They aren't allow to choose hours so it should only be factoring in full days.



    Ginny Smith


    11609 Marion Rd,

    512 569 7995

    Sanger, TX 76266

    Local Accomodations: Century 21



    Rental Location:

    Rental Dates:

    8200 Mountain Sports

    03-13-2016 - 03-18-2016 = 5.96 Days

     (719) 873-1977

    Number of Renters: 4










    R or L


    Hayden Smith



    6' 2"

    175 lbs.



    Premium Demo Snow Board Package



    Wilding Smith



    6' 2"

    265 lbs.



    Premium Demo Snow Board Package



    Braven Smith



    6' 4"

    190 lbs.



    Premium Demo Snow Board Package



    Joseph Yarnell



    5' 11"

    185 lbs.



    Performance Snow Board Package


    Adult Helmet

    Page URL:

  • Profile Image
    JotForm Support

    Answered by david on February 24, 2016 at 12:11 PM

    I am able to reproduce the issue in your form and when I cloned your form to test it, I was able to reproduce it there as well.

    I will forward this to our developers to see what is causing the calculation amount to be a fractional value.  We will let you know via this thread as soon as we have any further information. 

    For now, you may want to disabled the decimal places:

  • Profile Image

    Answered by brooke833 on February 24, 2016 at 12:46 PM
    Thank you for your assistance, I will try that and I appreciate you taking a look as to why it’s yielding that result. I just wonder if changing it to not show decimal places will make it say 5 days instead of 6 days when the example I showed you had a result of 5.96 – do you think that would happen?

    Thank you!

    Brooke Smith
    Art Production Manager
    Graphic Design Dept: 1.866.657.2289 ext. 3
    Direct: 303.432.8996 ext. 701
    Fax: 1.866.240.6738

    *Proofing and Artwork Information - Your approval is required to send your order into production. Please review your order carefully for errors before approving. Once your order is approved, it is immediately sent into production and no further changes can be made. At Master Print and Web Design, Inc., Your success is our business and we consider it a privilege to have you as a customer. Thank You!

  • Profile Image
    JotForm Support

    Answered by david on February 24, 2016 at 02:02 PM

    It should round properly when using less decimal places:

    You can have a look at my test form to compare the two if you'd like:


  • Profile Image

    Answered by grade4pagasa on February 25, 2016 at 01:48 AM

    Hi David

    This post is related to the original thread, so no need to open a new thread for me.

    I was about to suggest to Brooke to use the floor or ceiling functions when I realized that there shouldn't be a reason for the date widget calculation to have an output of decimal numbers. 

    As you can see on the screenshot below [fig. 1], on the left is Brooke's (similar to your output) vs. the sample form I made. For the decimal field in my form, it actually calculates a whole number (integer) - I even had to force it to show empty decimal places (but as you can see, it's calculating a flat 5 as a result) [fig. 2]. 

    You will also notice that the floor() and ceil() output on my form all gives the same output = 5 - that's because 5 is already an integer, so no change in the output is expected even after applying the floor() and ceil() functions. 

    By the way, Brooke adds 1 to the date calculation [fig. 3], but even with this setup, I still receive an integer (whole number) of 6 when I enter the dates she specified March 13 - 18. 

    Which brings me to another concern, when I used the Dates Diff widget, it gives an output of 6 days for March 13 - 18. Compare this to 5 when we calculate the dates manually [fig. 4]. 

    Screenshot of the email notification is included  [fig. 5]. 

    In summary:

    * I'm getting an integer (whole number) while you and Brooke are getting output with decimal numbers when calculating the date difference.

    * The calculated result in days is different when we do it manually (March 13 - 18) vs. using the Dates Diff widget.


    - Randy 


    fig. 1 


     fig. 2



    fig. 3




    fig. 4




    fig. 5

  • Profile Image
    JotForm Support

    Answered by NicholasWestley on February 25, 2016 at 02:24 AM


    This issue has now been fixed.  It was occuring because the calculation assumed there is the same number of hours in each day.  The clocks change from daylight saving next month so if the start date is before and end date after the change the result would be a non-round number of days. It is now using UTC time which does not change so will no longer occur.

    Please let us know if you continue to have problems.



  • Profile Image

    Answered by skrajaji on February 25, 2016 at 03:33 AM

    Good info

  • Profile Image

    Answered by brooke833 on February 25, 2016 at 08:45 AM
    Thank you for the explanation, I appreciate your help!

    Brooke Smith

  • Profile Image
    JotForm Support

    Answered by david on February 25, 2016 at 11:12 AM

    You are very welcome.  If there is anything else we can assist you with, let us know and we will be happy to help.