How can I subtract 90 minutes from the Time Field?

  • hsts
    Asked on June 7, 2017 at 12:37 PM

    Wondering if the calculator or any other available widget will calculate time?

    Specifically, what I'm looking to do is have the submitter enter a time and have 90mins subtracted from that time and output for the submitter. 

    Ie. Submitter inputs 3:30pm and the calculator subtracts 90mins and outputs 2:00pm. 

    Thanks,

    Trina

  • Support_Management Jotform Support
    Replied on June 7, 2017 at 2:04 PM

    Hello Trina - I'm not 100% sure if this is doable but I'm currently fiddling around with the Time Field and Form Calculation. As soon as I have some results (good or bad), I'll let you know on this thread. Stay tuned!

  • Support_Management Jotform Support
    Replied on June 7, 2017 at 2:33 PM

    All right, does this form fit your needs https://www.jotform.com/71575675487978?

    If it does, can you clone that form and have a look at how I set it up? Basically, I used 1 Time Field and 4 Form Calculation Widgets to achieve that.

    Complete guide: How-to-clone-an-existing-form-from-a-URL

    If that works for you and you still need further explanation on how that was achieved, just let me know and I'll break it down into a step by step guide.

  • hsts
    Replied on June 7, 2017 at 3:01 PM

    Thank you so much.  This is exactly what I needed.  I'm going to try and follow it through so you don't need to do the step by step.  Much appreciated!

  • Support_Management Jotform Support
    Replied on June 7, 2017 at 3:24 PM

    I'm glad that's exactly what you need. I failed to mention this only works well with 10 min stepping on the Time Field or above. Using 1 or 5 min stepping would result to some time formats that won't have a trailing 0.

    Sadly, that's just a limitation with how subtraction works. We can't place any trailing zeroes to whole numbers (from 1 to 9).

     

  • hsts
    Replied on June 7, 2017 at 3:30 PM

    Okay, thanks for information.  I did change to 1 stepping increment already as this is what we would need.  Now that you said wouldn't work well I went back and tested.  From what I can see only the 31-39 min increments seem to spit out the incorrect result.  This make sense that only that range?

  • Support_Management Jotform Support
    Replied on June 7, 2017 at 4:11 PM

    Sorry but I need to correct the term I used - It's not trailing zeroes but rather leading zeroes.

    When using 1 minute or 5 minute stepping, any difference that would result from 0 to 9 would not show a leading zero. That's why a minute selection of 30 to 39 minus 30 would result to a range of differences from 0 to 9 (instead of 00 to 09).

    I tried playing around with conditions and managed to find this workaround:

    How can I subtract 90 minutes from the Time Field? Image 1 Screenshot 30

    Just ensure that once you're setting up each of these 10 conditions (from 0 to 9), click the leading 0 so it has a brown background. Refer to the screencast below:

    How can I subtract 90 minutes from the Time Field? Image 2 Screenshot 41

    Check my test form again https://www.jotform.com/71575675487978 to see it in action.

  • hsts
    Replied on June 8, 2017 at 7:48 AM

    That worked great, thank you again!  Very impressed by the support.  

    One last question, what is clicking on the zero and the background being brown actually trigger?

     

  • hsts
    Replied on June 8, 2017 at 7:57 AM

    I lied, I have another question.  Is there any workaround to have the final time in 12hr format?

  • hsts
    Replied on June 8, 2017 at 8:28 AM

    I'm sorry another question -

    My form seems to be defaulting to have 10:30 in the output time field.  I'm unsure why this is. I have tried the default result set to 'blank' and '0' neither options are changing the default result when no time has yet been entered into the entry field.

    Form link: https://form.jotformpro.com/71575830752966

  • Nik_C
    Replied on June 8, 2017 at 11:47 AM

    One last question, what is clicking on the zero and the background being brown actually trigger?

    If you meant how to remove the yellow highlight around the field, here is how to do that:

    How can I subtract 90 minutes from the Time Field? Image 1 Screenshot 40

    -Click Settings-Show more options:

    How can I subtract 90 minutes from the Time Field? Image 2 Screenshot 51

    -Scroll a bit down and disable it:

    How can I subtract 90 minutes from the Time Field? Image 3 Screenshot 62

    Is there any workaround to have the final time in 12hr format?

    I tried to make this work but it will be hard to make it work properly because of the negative value you get when the number is less than 1.5 (90minutes). I will have to check that more and if I make it work I'll get back to you.

    I opened a new thread for your last question and we will attend it here shortly: https://www.jotform.com/answers/1167456

    Thank you!