How to get number of hours between 06:00 -> now?

Hi!

Im working on an app to calculate a patients postoperative fluid balance. One of the losses is perspiration, which is calculated as 10ml/kg/h.

The day-cycle on the hospital is 06:00 - 05:59, and my plan is to have a button that, when being tapped, calculates the fluid balance from 06:00 at day of surgery, to the moment the button is "activated".

As long as the the date when you tap the button is the same date as day of surgery, this should be relatively easy, but the problem is when the night shift calculates fluid balance in the morning before transfer (around 05:00, which would return 23 hours). Or if the night shift is busy and do the calculation like 06:30, which would return 24,5 hours.

I have no way of getting the date of surgery (except from asking the user to fill it in, but that would not be as elegant).

Is there any way of achieving this? Or should I surrender and just ask the user for date of surgery?

Hope the use case was understandable and any help is much appreciated!

Also remember to handle the cases where the clocks go forward (or back), during your time interval!

How to get number of hours between 06:00 -> now?
 
 
Q