SQL Server 2012 – DATEFROMPARTS
In SQL Server 2012, seven new datetime functions have been introduced. DATEFROMPARTS is one of them.
Syntax:
DATEFROMPARTS (year, month, day)
DATEFROMPARTS returns a date value with the date portion set to the specified year, month and day, and the time portion set to the default. If the arguments are not valid, then an error is raised. If required arguments are null, then null is returned.
Example:
SELECT DATEFROMPARTS (2012, 04, 11) AS Date;
Result:
Date
————–
2012-04-11