Get the specified time is the week of the month

--Create function Sunday is the last day. . . . Modify
 create function GetWeek if necessary ( 
--@num1 int , @num2 int @time1 datetime ) returns int as begin declare @return int set @return = (select datepart(d,@time1)/7 + (case when datepart(d,@time1)%7>datepart(weekday,@time1) then 2 when (datepart(d,@time1)%7 = 0 and datepart(weekday,@time1) = 7) then 0 else 1 end) ) return @return end 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324733660&siteId=291194637