Rounding Off Datetimes - SQL Server

The following SQL statement demonstrates how to TRUNCATE a datetime to seconds — to discard fractional seconds. The same can be done for any unit of time (day, month, year, etc.)

declare @BaseDate datetime = '2016-01-01'

select top 10 
     BatchDate = dateadd(SECOND, datediff(SECOND, @BaseDate, UpdatedOn), @BaseDate)
    ,Qty = count(2)
from
    dbo.UploadedData
where 1=1
    and UpdatedOn >= '2016-10-10'
group by
    dateadd(SECOND, datediff(SECOND, @BaseDate, UpdatedOn), @BaseDate)