How to get week number of the month from the date in SQL server?
How to get week number of the month from the date in SQLΒ server?
This is such a simple way to get the week number of the month.
declare @date date = β3 Nov 2019β
select convert(int, datepart(wk, @date)) β convert(int, datepart(wk, DATEFROMPARTS(YEAR(@date),MONTH(@date),1))) + 1
β return 2
Β *calendar starts from SUNDAY as the first day.
View On WordPress









