**zehrabatool**i want to calculate the time in the following field, how can i achieve this?

- JotForm Support
**Nik_C**Maybe you could enable time range for one time field:

And then you could add Text field that could show the range:

And it would look like this:

Could that work for you?

Please let us know.

Thank you!

**zehrabatool**No it won’t be working for me.

As I won’t hours and minutes separately in text field.

As I have shown you in a figure below.

I don’t want it to be done by using date picker field. How can I obtained it by using only time field?

Regards

zehra

...**zehrabatool**No it won’t be working for me.

As I want hours and minutes separately in text field.

As I have shown you in a figure below.

I don’t want it to be done by using date picker field. How can I obtained it by using only time field?

Regards

zehra

...- JotForm Support
**Nik_C**I understand.

I was able to make a logic that will calculate hours and minutes between two fields and place them in separate fields.

It's a bit complicated but it is doing what you need.

1) Change the time field to 24h time format:

And do that for both time fields.

2) The issues we have in this calculation is that we need the time and hours separated, but also we need those two correct if the value is negative, for example out time is 15:10 and in time is 10:50, if we just subtract them we will get 5h and -40 minutes, so we need some additional fields:

And Minutes total is

**Form calculations widget**.They could be all hidden except Hours final and minutes final since there we will show the final hours and minutes difference.

3) Now we create some conditions:

-First the hours:

Since it will be the decimal number we use the round function and that will give us hours number

-Second, we create a condition for minutes:

-To extract the actual minutes, we use the Form Calculations widget we added to the form:

We subtract the minutes and hours to get the decimal part, multiply that number with 3600 to get seconds and divide with 60 to get the minutes. Finally we round that number to get the actual minutes value.

4) To cover the negative numbers I mentioned above, we add four more conditions:

-For negative:

So if the minutes is less than zero, we subtract number one from the hours and enter in hours final field (that's our total hours) and similarly for minutes we add 60 to value so we get the number of minutes.

-For positive:

We just copy the values to hours total and minutes total.

Here is my test form so you can check it out: https://form.jotformpro.com/71561743287967

Again, the temp value fields should be hidden:

Please let us know your thoughts.

Thank you!

**zehrabatool**Why it’s not showing in Final hours ?

...- JotForm Support
**liyam**Hello,

I just tested the form provided by Nik_C and the field appear to be properly filled after filling up time 1 and time 2:

Can you try refreshing the form page to see if the problem appears still?

Thanks.

**zehrabatool**Please kindly see this screenshot, when I am selecting time 1: 1:00 and time 2: 2:00.

It’s not showing in final hours and final minutes.

Link is as following:

https://form.jotformpro.com/71561743287967

Do you please help me as soon as possible?

...- JotForm Support
**Nik_C**My apologies, that is happening because I didn't cover that situation. But that is easily done by adding two more conditions:

But if you don't want zero to show for minutes, you can include only first condition.

And here is my updated form: https://form.jotformpro.com/71561743287967

Let us know how it worked for you.

Thank you!

- JotForm Support
**Chriistian**@SafetyJNJMech,

Thanks for your update. Yes, you are correct, the Minutes Total field is a Form calculation widget so you can add an extra calculation to it to get the break time deduction.

We appreciate your kind words. If you have questions or concerns, please open a separate thread and we will be happy to assist you.

Regards.