It will work fine if the time difference is guaranteed to be less than 24 hours.However, if the time difference is greater than 24 hours, it will not give you what you want as it will display the number of hours modulo 24. This will return the time difference including milliseconds. Does anyone have any ideas?Thanks!Michael. I have searched and have not found anything. I have the following T-SQL code to change the difference between datetime columns into hours, minutes, and secondsCONVERT(varchar(6), DATEDIFF(second, b.DateTimeStamp, c.DateTimeStamp)/3600) + ':' + RIGHT('0' + CONVERT(varchar(2), (DATEDIFF(second, b.DateTimeStamp, c.DateTimeStamp)% 3600) / 60), 2) + ':' + RIGHT('0' + CONVERT(varchar(2), DATEDIFF(second, b.DateTimeStamp, c.DateTimeStamp)% 60), 2)but I also wanted milliseconds.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |