How to Get the Quarter 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(qq, GETDATE())

datename_quarter_getdate

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

datename_quarter_datetime

SELECT DATENAME(qq, '2013-06-15')

datename_quarter_date