T-SQL 计算日期所属当月的第几周

DECLARE @date date = '2024-10-30'
SELECT (day(datediff(d,0,@date)/7*7)-1)/7+1

output: