I'm trying to calculate the difference between two hours. However, I would not like to inform the dates. I would like to know for example that between 23:00 to 01:00, 120 minutes have passed.
What I tried to do and got something similar was like this but I had to inform the dates:
DECLARE @antes DATETIME = '2016-10-20 23:00:00.000';
DECLARE @depois DATETIME = '2016-10-21 01:00:00.000';
SELECT CONVERT(VARCHAR, DATEDIFF(HOUR, @antes, @depois)) + 'H'
+ RIGHT('00' + CONVERT(VARCHAR, DATEDIFF(MINUTE, @antes, @depois) % 60), 2) + ':'
+ RIGHT('00' + CONVERT(VARCHAR, DATEDIFF(SECOND, @antes, @depois) % 60), 2);