Monday, December 27, 2010

Get Current Year, Month and Future date

declare @fdate datetime
set @fdate = '12/20/2012'
-- current month, current year, fut date
-- you can change the date param with your choice
SELECT CAST(CAST(DATEPART(MONTH,GETDATE()) as varchar(2))+ '-' 
 + CAST( DATEPART(DAY,@fdate) as varchar(2)) +'-' 
 + CAST( DATEPART(YEAR,GETDATE()) as varchar(4)) as datetime) as newdate

No comments:

Post a Comment