| title | DATETIMEFROMPARTS (Transact-SQL) | ||
|---|---|---|---|
| description | DATETIMEFROMPARTS (Transact-SQL) | ||
| author | markingmyname | ||
| ms.author | maghan | ||
| ms.date | 01/29/2021 | ||
| ms.prod | sql | ||
| ms.technology | t-sql | ||
| ms.topic | reference | ||
| f1_keywords |
|
||
| helpviewer_keywords |
|
||
| dev_langs |
|
||
| monikerRange | >= aps-pdw-2016 || = azuresqldb-current || = azure-sqldw-latest || >= sql-server-2016 || >= sql-server-linux-2017 || = azuresqldb-mi-current |
[!INCLUDE sql-asdb-asdbmi-asa-pdw]
This function returns a datetime value for the specified date and time arguments.
Transact-SQL Syntax Conventions
DATETIMEFROMPARTS ( year, month, day, hour, minute, seconds, milliseconds )
[!INCLUDEsql-server-tsql-previous-offline-documentation]
year
An integer expression that specifies a year.
month
An integer expression that specifies a month.
day
An integer expression that specifies a day.
hour
An integer expression that specifies hours.
minute
An integer expression that specifies minutes.
seconds
An integer expression that specifies seconds.
milliseconds
An integer expression that specifies milliseconds.
datetime
DATETIMEFROMPARTS returns a fully initialized datetime value. DATETIMEFROMPARTS will raise an error if at least one required argument has an invalid value. DATETIMEFROMPARTS returns null if at least one required argument has a null value.
This function is capable of being remoted to [!INCLUDEsssql11-md] servers and above. It is not remoted to servers that have a version below [!INCLUDEsssql11-md].
SELECT DATETIMEFROMPARTS ( 2010, 12, 31, 23, 59, 59, 0 ) AS Result; [!INCLUDEssResult]
Result
---------------------------
2010-12-31 23:59:59.000
(1 row(s) affected)