Skip to content

DATEFROMPARTS

  • 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.
SELECT DATEFROMPARTS ( 2020, 12, 31 ) AS NewYear;
NewYear
2020-12-31 00:00:00.000

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’.