title: "DATEFROMPARTS (Transact-SQL) | Microsoft Docs" ms.custom: "" ms.date: "07/29/2017" ms.prod: sql ms.prod_service: "database-engine, sql-database, sql-data-warehouse, pdw" ms.component: "t-sql|functions" ms.reviewer: "" ms.suite: "sql" ms.technology: t-sql ms.tgt_pltfrm: "" ms.topic: "language-reference" f1_keywords:
- "DATEFROMPARTS_TSQL"
- "DATEFROMPARTS" dev_langs:
- "TSQL" helpviewer_keywords:
- "DATEFROMPARTS function" ms.assetid: 5b885376-87aa-41f1-9e18-04987aead250 caps.latest.revision: 16 author: edmacauley ms.author: edmaca manager: craigg monikerRange: ">= aps-pdw-2016 || = azuresqldb-current || = azure-sqldw-latest || >= sql-server-2016 || = sqlallproducts-allversions"
[!INCLUDEtsql-appliesto-ss2012-all-md]
Returns a date value for the specified year, month, and day.
Transact-SQL Syntax Conventions
DATEFROMPARTS ( year, month, day ) year
Integer expression specifying a year.
month
Integer expression specifying a month, from 1 to 12.
day
Integer expression specifying a day.
date
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.
This function is capable of being remoted to [!INCLUDEssSQL11] servers and above. It will not be remoted to servers with a version below [!INCLUDEssSQL11].
The following example demonstrates the DATEFROMPARTS function.
SELECT DATEFROMPARTS ( 2010, 12, 31 ) AS Result; [!INCLUDEssResult]
Result
----------------------------------
2010-12-31
(1 row(s) affected)