Below is example of SQL query which will give number of days in month for given date:
DECLARE @dtDate AS DATETIME = GETDATE() --This will select current date.
SELECT DAY(DATEADD(MONTH, 1, @dtDate) - DAY(DATEADD(MONTH, 1, @dtDate)))
DECLARE @dtDate AS DATETIME = GETDATE() --This will select current date.
SELECT DAY(DATEADD(MONTH, 1, @dtDate) - DAY(DATEADD(MONTH, 1, @dtDate)))
Great ...work..
ReplyDelete