By using below code you can find the day count-number of days in particular month
So here it is,
DECLARE @dtDate DATETIME
SET @dtDate = ‘8/18/2007’
select datediff(day, dateadd(day, 1-day(@dtDate), @dtDate),
dateadd(month, 1, dateadd(day, 1-day(@dtDate), @dtDate))) as dayCount
you will get output like,
Here august month passed in dtDate parameter of sql so will have an output 31 day count.