Sometimes you need to round DateTimes in T-SQL to a certain DateTime component. For example, you need to truncate the minutes and seconds and only keep the date and the hour. To do so, you can do this:
SELECT DATEADD(hh, DATEDIFF(hh, '20000101', getdate()), '20000101')
This turns 20120101 13:59:59 into 20120101 13:00:00. Please note that the comparison date 20000101 is totally arbitrary. You can use any day before the date you’re truncating.