DATEPARTdayofyear
DATEPART(dayofyear) is a datepart function used in Microsoft SQL Server’s T-SQL to return the ordinal day of the year for a given date. It extracts the position of a date within its year, counting from January 1 as 1.
The typical syntax is DATEPART ( datepart , startdate ), where datepart is dayofyear (often written as dayofyear or
Common uses include calculating year-to-date metrics, sorting or grouping data by the position of a date within
Notes and caveats: SQL Server supports various datepart tokens; dayofyear is one of them, and other systems
In performance terms, DATEPART is a scalar function and can affect query plans if used on indexed