SQL Server - Working With Dates Part 2
In Part 2 of our “SQL Server - Working With Dates” blog we use the DATEPART function.
DATEPART Function
DATEPART works in the same way as DATENAME, but returns numbers for the weekday and month instead of the word. (weekdays start with 1 for Sunday by default, but this can be changed).
The following example shows a comparison of DATENAME and DATEPART: