默认第一天是周日:
declare @FridayDate datetime
if (DATENAME(dw, getdate()) = 'Sunday') select @FridayDate = DATEADD(wk, DATEDIFF(wk,0,getdate()), -3) else select @FridayDate = DATEADD(wk, DATEDIFF(wk,0,getdate()), 4)
select @FridayDate
Powered by: 博客园 Copyright © 2024 LonelyStar Powered by .NET 9.0 on Kubernetes