@p22为输入的日期
DECLARE @Start_Date NVARCHAR ( 1000 )
DECLARE @End_Date NVARCHAR ( 1000 )
SET @Start_Date = Dateadd (wk, datediff (wk, 0 , @p22 ), 0 )
SET @End_Date = Dateadd (wk, datediff (wk, 0 , @p22 ), 7 )
另外一种方法
DECLARE @Start_Date NVARCHAR ( 1000 )
DECLARE @End_Date NVARCHAR ( 1000 )
SET @Start_Date = Dateadd (wk, datediff (wk, 0 , @p22 ), 0 )
SET @End_Date = Dateadd (wk, datediff (wk, 0 , @p22 ), 7 )
另外一种方法
本周六
select DATEADD(wk, DATEDIFF(wk,0,@date ), 6-1)
本周一
select DATEADD(wk, DATEDIFF(wk,0,@date ), -1)