Convert a date to the first of the month
convert(datetime,stuff(dtdate,5,2,'01'))
It appears that this acts on a date formatted as
May 15 2011 11:00AM
This line 'stuffs' the string '01' into the day portion of the date, and then converts the result back to a datatime variable.
Clear out the time portion of a DATETIME
Based on that, we can also do this to clear out the time portion
print stuff(getdate(),13,7,'12:00 AM')
Get a date in the format of 'Jan 2012'
stuff(convert(varchar(12),@as_of),4,3,'') as monthYear2
Get a date in the format of 'MMYYYY'
set @output = stuff(convert(varchar(10),@input,101),3,4,'')