Convert day number to full date in SQL Server

Viewed 8923

I searched a lot online and could not find it. I found just the opposite - date to day

For example: Day 221 ==> 09/08/2017

This query do from this date to day number:

SELECT DATEPART(DAYOFYEAR, SYSDATETIME())

or

SELECT DATEDIFF(day, CAST(DATEPART(YEAR, GETDATE()) AS CHAR(4)) + '-01-01', GETDATE() + 1) AS number_of_today

Thanks

4 Answers
Related