SQL Flow Field Guide

DATEFROMPARTS

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

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 Flow
SELECT DATEFROMPARTS(2026, 4, 5) AS event_date;

Open Microsoft Learn for full syntax, permissions, and details for your version.