bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

SQL Server DATEFROMPARTS() Function

Concept visual

SQL Server DATEFROMPARTS() Function

Pointer walk
two pointers
leftright102132436485116
left=0
right=6
1
3

Start at both ends

Example

Return a date from its parts:

SELECT DATEFROMPARTS(2018, 10, 31) AS DateFromParts;

Definition and Usage

The DATEFROMPARTS() function returns a date from the specified parts (year, month, and day values).

Syntax

Datefromparts(

year, month, day )

Parameter Values

Parameter

Description year

Required. Specifies a year (4 digits) month Required. Specifies a month (from 1 to 12) day Required. Specifies a day (from 1 to 31)

Technical Details

Return type:

date

Works in:

SQL Server (starting with 2012), Azure SQL Database, Azure SQL Data Warehouse, Parallel Data Warehouse

Previous

❮ SQL Server Functions

Next

Previous

SQL Server DATEDIFF() Function

Next

SQL Server DATENAME() Function