I am trying to get the hours between the two dates using DATEDIFF(HOUR, FromTime, ToTime)
but when the time is 00:00:00. And the I got the negative and wrong hours.
Code Below:
See Question&Answers more detail:osselect FromTime, ToTime, datepart(HH, FromTime) as fromtimehours, datepart(HH, ToTime) as totimehours, DATEDIFF(HOUR, FromTime, ToTime) as totalhours from table