Fizzgig Fizzgig - 1 year ago 70
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))
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download