Magda Bronowska rounds to the nearest minute:
From MS Learn:
DATETRUNC() function returns an input date truncated to a specified datepart.
On the surface the work similarly to
DATEPART()
, however that function returns integer values, opposed to the dates returned byDATETRUNC()
(we will see that better in the example below).
Read on for plenty of examples of this, as well as two more syntax updates in SQL Server 2022.