alter procedure p_date
@year int=2005,    --年份
@week int=33,    --第几周
@firstday datetime =null output,  --此周的第一天
@endday   datetime =null output   --此周的最后一天
as
declare @currentWeek int,@currentFirstday datetime
select @currentWeek=datepart(week,getdate()),
       @currentFirstday=dateadd(day,1-datepart(weekday,getdate()),getdate())
select @firstday=dateadd(day,7*(@week-@currentWeek),@currentFirstday),
       @endday=dateadd(day,7,@firstday)
--select @firstday,@endday
go

 

[文章转载于csdn论坛: http://bbs.csdn.net/topics/70513840]

相关文章:

  • 2022-12-23
  • 2022-02-10
  • 2021-04-24
  • 2022-12-23
  • 2021-10-11
  • 2022-01-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-12
  • 2022-02-11
  • 2021-12-01
相关资源
相似解决方案