Thanks for reaching out to Jotform Support. You can try using the Time field, let me show you how to set it up to do this calculation automatically. Let's go through it:
Open the form in Form Builder.
Find and select the Time field.
Click on the Gear icon to open the Properties.
Click on Range and enable the options Time Range and Duration Indicator.
Feel free to reach out again if you have any questions or if we can help you in any other way.