SQLTeam.com | Weblogs | Forums

Calculate elapsed business/work time in hours:Minutes format

I'm trying to figure out how to calculate elapsed time between two business work dates in hours and minutes format. For example, I would like to compare two dates using a business start time of 8am and a business end time of 5pm and exclude Saturdays and Sundays. I would like the results to be displayed in hours:minutes. Can anyone assist with this?
Ex. Select calculateBusinessHoursWorked(' 2019-09-10 06:00:00.437', '2019-09-10 08:00:00.437')
Results 2h:0m

Hope these links helps

https://intellipaat.com/community/47899/how-to-calculate-time-difference-in-hours-and-minutes-in-sql-server#:~:text=We%20can%20be%20use%20CONVERT,timestamps%20in%20hours%20and%20minutes.

Please google search lots lots lots of stuff
Very very very very very very very very very
Common scenario

Why two hours? There was only 0.437 secs that occurred during work hours.

If you just want the raw clock difference, you can use DATEDIFF(MINUTE, ) / 60.0 as in standard SQL.