I need help in converting seconds to HH:MM: SS in SQL Server.
This is the code I have:
SELECT
CONVERT(varchar(8), DATEADD(SECOND, DATEDIFF(SECOND, '2020-11-28 16:03:53.200', '2020-11-28 16:25:53.200'), 0), 114) AS Runtime
OUTPUT: 00:22:00
The above code works when the date difference is within one day, but if the date difference is more than one day then this code is not working
SELECT
CONVERT(varchar(8), DATEADD(SECOND, DATEDIFF(SECOND, '2020-11-28 16:03:53.200', '2020-11-29 16:25:53.200'), 0), 114) AS Runtime
OUTPUT : 00:22:00
Thanks,