---当前周的第一天 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 ‘本月最后一天‘
时间: 2024-09-27 01:03:08