How to Get the Day of the Year from a Date in SQL Server

To get the day of the year from a date in SQL Server, you can use DATENAME Built-in Function:

SELECT DATENAME(dy, GETDATE())

datename_day_of_the_year_getdate

SELECT DATENAME(dy, '2013-02-01 15:48:26.467')

datename_day_of_the_year_datetime

SELECT DATENAME(dy, '2010-02-02')

datename_day_of_the_year_date