Calcular Horas / Calculating hours

  • JCLAUDIOSGO
    Asked on September 21, 2015 at 10:13 AM

    Meus amigos

     

    Por favor, precisamos resolver este pequeno problema.

     

    Não consigo fazer o form calcular as horas que uma pessoa ficou em um lugar.

     

    Exemplo: Chegou as 10:31 Saiu as 11:30, ficou no local 59 minutos

     

    É isto que preciso que o form faça.

     

    Me ajudam, por favor.

  • Ben
    Replied on September 21, 2015 at 2:34 PM

    The easiest method would be to add the Time field and set it up to ask for Range.

    Now, this does not allow you to make the calculation, but if you can tell us a bit more details in regards to what you would like to accomplish, we would be happy to assist you with this in more detail.

    What I wanted to check is if you are looking to see how long they were on the form or to have them select both start and end time?

  • JCLAUDIOSGO
    Replied on September 21, 2015 at 2:53 PM

    O que preciso é  seguinte:

    O usuário vai para um local e chega lá as 10:00, depois sai deste mesmo local as 10:38, ou seja, ele ficou neste local 38 minutos.

    É exatamente isto que preciso.

    Obrigado

     

  • Ben
    Replied on September 21, 2015 at 4:57 PM

    I am still not sure if you need to capture the time they have spend on the form or if you are looking to have your users set the start and end time.

    I will take it that they are going to set both times, since the other alternative is easy to do, by utilizing a widget such as Time Tracker.

    Now to calculate the difference we will need two time fields and a form calculation.

    We then set the form calculation to capture the time, but since the users might want to make some fun and enter the end time into the start time, we will use abs() function to make sure that we are working with the positive numbers.

    Now we will also add floor() function which will allow us to round the number to the first under, while we set the Form Calculation to not show any decimal places.

    The next important thing is to simply deduct the start time from the end time and then have all of that multiplied by 60 (since we are after minutes).

    You can see the setup on the following screenshot:

    Calcular Horas / Calculating hours Image 1 Screenshot 20

    You can see how this looks here: http://form.jotformpro.com/form/52635690603961

    You can clone the form to your own account for further testing and looking into by cloning it as shown here: How to Clone an Existing Form from a URL

    Do let us know if you happen to have any issues setting it up or questions and we would be happy to assist.

  • JCLAUDIOSGO
    Replied on September 21, 2015 at 5:16 PM

    Ben

    Muito obrigado

    Ficou 98% fantástico

    Para chegar no 100%, tem como transformar em horas, por exemplo:

    10hs30 as 10hs29 = 59 minuitos

    10hs30 as 11hs31 = 01hora e 01 minuto

     

    Ou seja, acima de 60 minutos, transformar em horas ?

    Grato

  • Chriistian Jotform Support
    Replied on September 21, 2015 at 10:59 PM

    Hi,

     

    You can set this up by adding another Calculation fields that will compute the number hours and minutes. Here is a step by step guide on how to setup a work hours tracker.

    1. Add 3 calculation widget for the computation of the Hours and minutes then for the formatted output. You can hide the fields that are not needed to be display. 

    Calcular Horas / Calculating hours Image 1 Screenshot 50

    2. Setup formula for the Hours.

    Calcular Horas / Calculating hours Image 2 Screenshot 61

     

    3. Setup formula for Minutes.

    Calcular Horas / Calculating hours Image 3 Screenshot 72

    4. Add condition for the Time (Formatted) field.

    Calcular Horas / Calculating hours Image 4 Screenshot 83

     

    Here is a sample form that you can check - http://www.jotformpro.com/form/52638185019964.

     

    Do let us know if you need further assistance.
    Regards.