DATEFROMPARTS
date/time arithmetic, parts, construction or truncation
What changes
- Input
- date/time arguments
- Output or change
- date/time or integer value
- Return type
- date
Syntax at a glance
DATEFROMPARTS ( year, month, day )
Work example
Create a date from separate year, month, and day fields.
Pass integer components instead of joining text and relying on session date formats.
Check your work Invalid calendar parts raise an error, while a null part returns null.
Practice SQL
Open in SQL FlowSELECT DATEFROMPARTS(2026, 4, 5) AS event_date;
Open Microsoft Learn for full syntax, permissions, and details for your version.