Monday, February 13, 2012

How To Get Week Start date and Week End date

--GET Start Day of Week

 

declare @no int,@date datetime=GETDATE()

select @no=DATEPART(WEEKDAY,@date)

select @date-(@no-1)


--GET End Day of Week

 

declare @no int,@date datetime=GETDATE()

select @no=DATEPART(WEEKDAY,@date)

select @date+(7-@no)

No comments:

Post a Comment