SQL日求日期

来源:互联网 发布:淘宝注册资金要多少钱 编辑:程序博客网 时间:2024/05/01 06:17
//求昨天
select convert(varchar(10),getdate()-1,120)
//求明天
select convert(varchar(10),getdate()+1,120);
//求最近七天
select * from tb where  时间字段>=convert(varchar(10),getdate()-7,120);
//求后七天
select * from tb where  时间字段<=convert(varchar(10),getdate()+7,120) and 时间字段等于>=时间字段;
0 0