DECLARE @mydate DATETIME
SET @mydate = '1986/01/21'
SELECT DAY(DATEADD(DAY,-DAY(@mydate),DATEADD(MONTH,1,@mydate))) as DAYSCOUNT
Above query will return number days in a month. Actually it return last date of given month. This is simplest way to get number of days in a given month.