Getting Date from DaysOfYear

declare @year int
declare @dayofyear int

set @year = 2011
set @dayofyear = 229

select dateadd(day, @dayofyear-1, dateadd(year, @year-1900, 0))

Getting DayOfYear from Date

select datepart(dayofyear, '20060701')

Get Month Name from Month Number

DECLARE @Mth smallint
SET @Mth = 11
SELECT DateName(mm,DATEADD(mm,@Mth,-1)) as [MonthName]

Comments (0)