20

2 FEB is the 33rd day of the year, for example.

Is there a built-in T-SQL function that returns the day-of-year (in SQL Server 2000)? Or do you have to roll your own using casts to get the first day of the year for the supplied date, and then do a DateDiff?

LittleBobbyTables - Au Revoir
  • 32,008
  • 25
  • 109
  • 114
Tim
  • 8,669
  • 31
  • 105
  • 183

1 Answers1

39
SELECT datepart(dayofyear, getdate())
LittleBobbyTables - Au Revoir
  • 32,008
  • 25
  • 109
  • 114