SQL DATEPART Function
SQL > SQL Date Functions >
DATEPART is a SQL Server function that extracts a specific part of the date/time value. Its syntax is as follows:
DATEPART (part_of_day, expression)
where part_of_day can have the following:
SELECT DATEPART (yyyy, '2000-01-20');
SELECT DATEPART (dy, '2000-02-10');
2000-02-10 is the 41st day in the year 2000.