In SQL Server, we can use the DATETRUNC()
function to truncate a date/time value to a specified precision.
For example, we could use it to truncate a date value like 2024-10-25 to 2024-01-01, or a time value like 10:35:12 to 10:00:00.
The DATETRUNC()
function was introduced in SQL Server 2022 (16.x).