DATEDIFF in HH:MM:SS format

前端 未结 6 953
予麋鹿
予麋鹿 2020-12-06 10:29

I need to calculate the total length in terms of Hours, Minutes, Seconds, and the average length, given some data with start time and end time.

For example the resul

6条回答
  •  执念已碎
    2020-12-06 10:54

    SELECT CONVERT(time, 
                   DATEADD(mcs, 
                           DATEDIFF(mcs, 
                                    '2007-05-07 09:53:00.0273335', 
                                    '2007-05-07 09:53:01.0376635'), 
                           CAST('1900-01-01 00:00:00.0000000' as datetime2)
                          )
                  )
    

提交回复
热议问题