DATEPART

Use the DATEPART function to return the value of a specific part of a date or timestamp. For example, return the hour of a timestamp or the month of a date.

The first parameter is the datepart, such as yy for year or mm for month. The second parameter is the date or timestamp expression.

These datepart formats are not supported: %D, %U, %u, %V, %w, and %X.

Syntax

DATEPART(datepart,date_expression)