create Function dbo.FormatCCDate(@inputdate Datetime)
returns varchar(15)
as
begin
--reformats a date in mm/dd/yyyy format to cyymmdd
declare @lngyear bigint
declare @lngday bigint
declare @lngmonth bigint
set @lngyear = year(@inputdate)
set @lngyear = @lngyear - 1900
set @lngday = day(@inputdate)
set @lngmonth = month(@inputdate)
return( cast(((@lngyear * 10000) + (@lngmonth * 100) + (@lngday)) as varchar) + convert(varchar, @inputdate, 108) )
end;
|