Convert HH:MM:SS string to number of minutes

后端 未结 8 615
醉梦人生
醉梦人生 2021-01-22 12:03

I have the below query.

select cast(dateadd(minute, datediff(minute, TimeIn, TimeOut), 0) as time(0) )

I get the results from two columns in th

相关标签:
8条回答
  • 2021-01-22 12:59
    SELECT DATEDIFF(minute,CAST('00:00' AS TIME), CAST('02:47' AS TIME)) AS difference
    

    Gives you:

    | DIFFERENCE |
    --------------
    |        167 |
    
    0 讨论(0)
  • 2021-01-22 13:02

    For SQL Server (works for 2005 too):

    select Datediff(mi,convert(datetime,'00:00:00',108), convert(datetime,'02:47:00',108))
    
    0 讨论(0)
提交回复
热议问题