Home > Software design >  Convert minutes into hours in SQL
Convert minutes into hours in SQL

Time:01-17

I want to convert 300 minutes into 5 hours. Input is 300 Output should be 05:00


CodePudding user response:

Try this:

select convert(varchar(5), dateadd(MINUTE, 300, '1970-01-01'), 108)

CodePudding user response:

Try this

` DECLARE @FirstDate datetime, @LastDate datetime

SELECT
@FirstDate = '2000-01-01 09:00:00',
@LastDate = '2000-01-01 11:30:00'

SELECT CONVERT(varchar(12), 
DATEADD(minute, DATEDIFF(minute, @FirstDate, @LastDate), 0), 114)

`

  • Related