calculating how many days remaining in a month or last day of month or any other scenarios
calculating how many days remaining in a month or last day of month or any other scenarios:
declare @numberOfDaysInMonth int;
set @numberOfDaysInMonth = DAY(DATEADD (m, 1, DATEADD (d, 1 - DAY(getdate()), getdate())) - 1);
declare @numberOfDaysInMonth int;
set @numberOfDaysInMonth = DAY(DATEADD (m, 1, DATEADD (d, 1 - DAY(getdate()), getdate())) - 1);
Comments