Construct a complete date using its individual components.
SELECT DATEFROMPARTS(2018, 10, 31) AS DateFromParts; |
DATEFROMPARTS() function constructs a date using provided year, month, and day values.
DATEFROMPARTS(year, month, day) |
Parameter |
Description |
year |
Required: Specifies a year using four digits. |
month |
Required: Specifies a month ranging from 1 to 12. |
day |
Required: Specifies a day ranging from 1 to 31. |
Return type: |
date |
Works in: |
SQL Server (beginning from 2008), Azure SQL Database, Azure SQL Data Warehouse, and Parallel Data Warehouse |