Ads 720 x 90

WeeksInAMonth

CREATE FUNCTION dbo.WeeksInAMonth(@Date DATETIME)
RETURNS INT
AS
BEGIN
RETURN DATEPART(week, @Date) - DATEPART(week, CONVERT(CHAR(6), @Date, 112)+'01') + 1
END
GO

SELECT dbo.WeeksInAMonth ('19980228')

Related Posts

Total Pageviews

Subscribe Our Newsletter