Fizzgig Fizzgig - 10 months ago 41
SQL Question

Finding the time between datetime values in metric format

I want to have a 'Duration' field in the format hours.minutes but I would like the minutes to be 'metric' (by which I mean in decimal format).
For example, the difference between

'2016-11-02 12:00:00.000'
'2016-11-02 13:45:00.000'
would be

Answer Source
SELECT CAST(DATEDIFF(MINUTE, '2016-11-02 12:00:00.000', '2016-11-02 13:45:00.000')/60.0 AS DECIMAL(5,2))