标签:
---当前周的第一天 select CONVERT(varchar(100),DATEADD(day,-(DATEPART(weekday,GETDATE())-1),GETDATE()) , 23)as‘周一‘, CONVERT(varchar(100),DATEADD(day,-(DATEPART(weekday,GETDATE())-7),GETDATE()),23) as‘周日‘, --求本月 CONVERT(varchar(100),dateadd(dd,-day(getdate())+1,getdate()),23) as‘本月第一天‘, CONVERT(varchar(100),dateadd(ms,-3,DATEADD(mm, DATEDIFF(m,0,getdate())+1, 0)),23) as ‘本月最后一天‘ , CONVERT(int, CONVERT(varchar(10),DATEADD(m,-2 ,dateadd(dd,-day(getdate())+1,getdate())) ,112)) as‘前三个月‘, --最近三个月 CONVERT(varchar(100),dateadd(ms,-3,DATEADD(mm, DATEDIFF(m,0,getdate())+1, 0)),23) as ‘本月最后一天‘
sqlServer 求当前周的第一天和最后一天,当前月的第一天和最后一天,前三个月的第一天和今天
标签:
原文地址:http://www.cnblogs.com/sunqiang/p/5253661.html