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

    Is there a way to calculate the total from the start time to the end time, and output the hours to the daily hours box

    Asked by cnumb on September 21, 2015 at 04:23 PM
    One more question, is there a way to calculate the total from the start time to the end time , and output the hours to the daily hours box ?
  • Profile Image
    JotForm Support

    Answered by Boris on September 21, 2015 at 07:36 PM

    Yes, you can set it up with some conditional logic, and assigning calculation values to hours in your drop down fields.

    I will walk you through setting it up for the first day of the first week, but the process is the same for all of them. So first thing we need to do is to assign calculation values to hours in the drop down fields. For field Sunday Start Time of week 1, I have added the following one:

    6
    6.5
    7
    7.5
    8
    8.5
    9
    9.5
    10
    10.5
    11
    11.5
    12
    12.5
    13
    13.5
    14
    14.5
    15
    15.5
    16
    16.5
    17
    17.5
    18
    18.5
    19
    19.5
    20
    20.5
    21
    21.5
    22
    22.5
    23
    23.5
    0
    0.5
    1
    1.5
    2
    2.5
    3
    3.5
    4
    4.5
    5
    5.5

    And for the End Time I have assigned the following calculation values:

    16
    16.5
    17
    17.5
    18
    18.5
    19
    19.5
    20
    20.5
    21
    21.5
    22
    22.5
    23
    23.5
    0
    0.5
    1
    1.5
    2
    2.5
    3
    3.5
    4
    4.5
    5
    5.5
    6
    6.5
    7
    7.5
    8
    8.5
    9
    9.5
    10
    10.5
    11
    11.5
    12
    12.5
    13
    13.5
    14
    14.5
    15
    15.5

    After setting them up, we can now use them in calculations. Basically, if user selects 9:30AM, calculated value of that option is 9.5, and 4PM calculates as 16.

    We then set up a calculation condition, by going to Setup & Embed > Conditions > Update a form field value, and setting it up to calculate End Time minus Start Time, and output it to Hours Today of these times:

    On the actual form, it will calculate to this:

    If you wish to prevent your users from submitting negative values (end time before starting time, such as they started at 9 AM but finished at 8 AM), you can set these calculations to use the MAX math function, and return the maximum value - either zero or that calculation.

    Here is a demo form with steps from above already implemented, but only for the Sunday of week 1. So only the first day is already set up on the demo form:

    http://form.jotformpro.com/form/52636830943965

    Please do let us know if you hit any snags along the way, and we will be happy to help.