UDF to get Day of the Year

,

CREATE FUNCTION dbo.fn_Today(@input datetime)

RETURNS varchar(50)

AS  

BEGIN 

declare @input='10/01/2003'
declare @output varchar(50)
select @output=   'Today is ' + DATENAME(mm,@input) + ' ' +DATENAME(dd,@input) + ','+ DATENAME(dw,@input) + '' +
 ' the ' + DATENAME(dy,@input)+ 'th' + ' ' +'Day' +' Of ' 
+ DATENAME(yy,@input)

RETURN (@output)

END


select dbo.fn_today('10/01/2003')

Rate

1 (1)

Share

Share

Rate

1 (1)