DATEFROMPARTS
DATEFROMPARTS(year, month, day);
Section titled “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
Section titled “Example”SELECT DATEFROMPARTS ( 2020, 12, 31 ) AS NewYear;Output
Section titled “Output”NewYear2020-12-31 00:00:00.000Explanation
Section titled “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’.