• This one doesn't work unless the @testdate is the 1st day of the month. E.g. with @testdate = '2011-01-30' it incorrectly returns 29.