Returns an integer value for the specified part of a date/time value.
DATEPART ( date-part, date-expression )
date-part The date-part to be returned.
For a complete listing of allowed date-parts, see the section “Date parts”.
date-expression The date for which the part is to be returned. The date must contain the date-part field.
The following statement returns the value 5.
SELECT DATEPART( month , '1987/05/02' ) FROM iq_dummy
Note that the DATE, TIME, and DTTM indexes do not support some date parts (Calyearofweek, Calweekofyear, Caldayofweek, Dayofyear, Millisecond).