How to convert Time to Decimal in SQL with an integer

后端 未结 3 1507
故里飘歌
故里飘歌 2021-01-26 18:14

I am having a couple of issues converting time to decimal...

Essentially I have used a DATEDIFF to identify the hours and minutes between two dates and times. This produ

相关标签:
3条回答
  • 2021-01-26 18:32
    Select DATEDIFF(second,  startdate, enddate)/3600.0
    
    0 讨论(0)
  • 2021-01-26 18:33

    Get the time difference in minutes, and divide by 60, this will place hours before the decimal separator and minutes after:

    datediff(minute, startdate, enddate) / 60.0
    
    0 讨论(0)
  • 2021-01-26 18:38

    As mentioned in this answer, "Take the DateDiff in seconds instead, and then divide by 86400.0. The decimal point is required."

    0 讨论(0)
提交回复
热议问题