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 Have the Number of Hours between Two Date/Time Field Entries Calculated and Displayed?

    Asked by excalibur101 on March 27, 2015 at 06:50 PM
    start date hours difference in hours date difference number of hours precision end date hours between
  • Profile Image

    Answered by Shadae on March 27, 2015 at 08:05 PM

    Hi excalibur101,

    Yes it is possible to have your start and date time calculated using two Form Calculation Widget fields.

    You would use the first calculation field to subtract the end date and time from the start date date and time.

    You would then use the second calculation to multiple the total from the first calculation by 24 to get the total difference in hours.

    You can view a sample form here: http://form.jotformpro.com/form/50857456175969

    Please feel free to clone this form to your account.

    I hope this helps! Please inform us if you need further assistance.

  • Profile Image

    Answered by excalibur101 on March 28, 2015 at 11:51 AM

    Thanks for your response. I didn't go any further than testing the link you supplied. When that calculation is done....it's wrong. For instance, if you input an eight hour period on a single date, the calculation says it's 7.92 hrs.  It's even off if you input a total of 30 minutes. 

    Any ideas?

  • Profile Image

    Answered by AlanJordan on March 28, 2015 at 12:13 PM

    I see the same issue.  The result for a 30-minute time difference is .48, not .50 hours.

  • Profile Image
    JotForm Support

    Answered by abajan on March 28, 2015 at 03:35 PM

    @excalibur101 and  AlanJordan

    Try this clone of my colleague's jotform. The expressions entered in its calculation fields are as follows:

    For the field labelled "Calculation" (hidden in my form) :


    For the "Hours" field:


    Of course, you're free to clone the form and examine it for yourselves.


    @AlanJordan

    Please open a separate thread if you need to discuss this further. (We've found it's better to deal with each user in their own thread.)

    Thanks

  • Profile Image

    Answered by TycenDemolitions on March 16, 2016 at 07:50 AM

    Excellent solution abajan ! works great for me! thanks.

     

  • Profile Image
    JotForm Support

    Answered by mert on March 16, 2016 at 09:09 AM

    On behalf of my colleagues, you are most welcome. I hope everyone in this thread will be satisfied with the answer. Please, do let us know for further information.

     

    Best regards.