sql 查询本周周一与周日时间
### 查询系统当前时间 SELECT GETDATE(); ### 查询本周周一时间 SELECT DATEADD(WEEK, DATEDIFF(WEEK, 0, CONVERT(DATETIME, GETDATE(), 120) - 1), 0); ### 查询本周周日时间 SELECT DATEADD(DAY, 6, DATEADD(WEEK, DATEDIFF(WEEK, 0, CONVERT(DATETIME, GETDATE(), 120) - 1), 0));
### 查询本周周一时间
select dateadd(week,0,DATEADD(week,DATEDIFF(week,0,getdate()),0));
### 查询本周周日时间
select dateadd(week,0,DATEADD(week,DATEDIFF(week,0,getdate()),6));
### 查询上周周一时间
select dateadd(week,-1,DATEADD(week,DATEDIFF(week,0,getdate()),0));
### 查询上周周日时间
select dateadd(week,-1,DATEADD(week,DATEDIFF(week,0,getdate()),6));