Find the Difference of two Date/Time pickers

I have to try to save a log of someone’s Time doing something. They fill out a form, with two date/time pickers and it finds the difference of two Date/Time pickers and logs it,

And the question is…?

How do I find the difference in time between two date/time pickers?

Do you want the answer in days, hours, minutes or seconds?

You can have a hidden input, where you simply use Datepicker A-DatePickerB formatted as whichever of the above you want
IF you need weeks, then pick days and divide by 7 etc.

I want it in Hours, like they fill out the form and on that form there is 2 Date/Time Pickers and when they submit the form, it finds the difference of the two and logs it. Like for Example. I put in Date/Time Picker A. (8/27/2020 4:25pm) and in Date/Time Picker B. (8/27/2020 7:45pm). It would find the difference and log it as 3 hours and 20 min.

Set date picker as date and time and select time interval as you prefer.

Then do the calculation in the output field:

You can then claculate hours and minutes from the minutes i.e /60

That worked! Thank you!

You’re welcome

Say I wanted it to keep adding hours every time they filled it out what would I do for that?

Like in the workflow
Hours= Current Users Hours+inputs value

image

@christo1
Can you help me with this.
I have two date time pickers lets say,
Start session 05-01-2023 20:00
End session 06-01-2023 22:00

so ideally diff should be 1Day2hrs.

So I want to calculate both at the same time. But we can choose either of the options.
Format as days
format as hours
format as minutes

how can we combine both?

Also almost requirement is same. I have two time pickers.
Session start 21:00
session end 02:00

So diff should be 5hrs.
But when I try to perform it gives negative value.
Will you guide me for this?