SQL Server DATETRUNC() Function
DATETRUNC(datepart, date) truncates a date/time value to the start of the requested date part and returns the same data type as the input. SQL Server introduced DATETRUNC() in SQL Server 2022 (16.x). See Microsoft’s DATETRUNC reference.
Syntax
DATETRUNC(datepart, date)
Supported date parts include year, quarter, month, week, iso_week, day, hour, minute, second, millisecond, and microsecond, when supported by the input type. weekday, tzoffset, and nanosecond are not supported. The input type must also have enough fractional-second precision for millisecond or microsecond truncation.
Truncate to the start of a month
Use DATETRUNC() to group values by a date part without building a new date with several DATEPART() calls:
DECLARE @occurred_at datetime2(0) = '2026-04-21T15:30:45';
SELECT DATETRUNC(month, @occurred_at) AS month_start;
The result is 2026-04-01 00:00:00.
Truncate to a week
For week, SQL Server uses the session’s @@DATEFIRST setting to choose the first day. For ISO weeks, use iso_week, which starts on Monday:
SELECT DATETRUNC(week, '2026-04-21T15:30:45') AS week_start,
DATETRUNC(iso_week, '2026-04-21T15:30:45') AS iso_week_start;
Use DATETRUNC() to return a date/time value at a period boundary. Use DATEPART() when you need a numeric part, or DATEDIFF() when you need a count of boundaries crossed.