Here is a small script that will give you the number of days for given month. Example purpose, i am retrieving month from the current date.
declare @numberOfDaysInMonth int;
set @numberOfDaysInMonth = DAY(DATEADD (m, 1, DATEADD (d, 1 - DAY(getdate()), getdate())) - 1);
Cheers Praveen. Useful.
ReplyDeleteThank you! This is great to have, works as well without the declaration if you need to use it on a per-row basis.
ReplyDelete