SQL Flow Field Guide

DATETIMEFROMPARTS

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
datetime

Syntax at a glance

DATETIMEFROMPARTS ( year , month , day , hour , minute , seconds , milliseconds )

Work example

Build a legacy datetime value from date and time parts.

Test month end, leap day, offset, and the session language that will run the query.

Check your work Use datetime2 for new work and test datetime range and rounding rules.

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