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

If the post helped you, please share it:
Pin It

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">