How to convert number of minutes to hh:mm format in TSQL?

前端 未结 12 2000
情话喂你
情话喂你 2020-12-03 09:48

I have a select query that has DURATION column to calculate number of Minutes . I want to convert those minutes to hh:mm format.

12条回答
  •  悲&欢浪女
    2020-12-03 10:14

    For those who need convert minutes to time with more than 24h format:

    DECLARE @minutes int = 7830
    SELECT CAST(@minutes / 60 AS VARCHAR(8)) + ':' + FORMAT(@minutes % 60, 'D2') AS [Time]
    

    Result:

    130:30
    

提交回复
热议问题