DATEFROMPARTS
DATEFROMPARTS is a SQL function that creates a date value by combining individual parts such as year, month and day.
DATEFROMPARTS(year, month, day);
- year: Specifies the year portion of the date as an integer.
- month: Defines the month of the year, represented as an integer from 1 (January) to 12 (December).
- day: Represents the day of the month as an integer from 1 to 31, in accordance with the specifics of each month.
Example
Output
Explanation
In the provided example, the DATEFROMPARTS
function is used to create a date from three integer values: the year, the month, and the day. The function thus returns the date ‘2020-12-31’.