DATETRUNC
date/time arithmetic, parts, construction or truncation
What changes
- Input
- date/time arguments
- Output or change
- date/time or integer value
- Return type
- The returned data type for DATETRUNC is dynamic. DATETRUNC returns a truncated date of the same data type (and, if applicable, the same fractional time scale) as the input date. For example, if DATETR
Syntax at a glance
DATETRUNC ( datepart , date )
Work example
Align a timestamp to a reporting period such as month or week.
Choose the week boundary expected by the report and group by the truncated value.
Check your work DATETRUNC keeps the input date type and fractional precision.
Practice SQL
Open in SQL FlowSELECT DATETRUNC(month, CONVERT(date, '2026-04-19')) AS month_start;
Open Microsoft Learn for full syntax, permissions, and details for your version.