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

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="">