Week of month

Last Post 21 Jun 2007 07:59 AM by nosepicker. 2 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
rosehcm2003
New Member
New Member

--
21 Jun 2007 12:38 AM
Hello,
Please help me about that I have date, I need to know this date within which week of month.
Example data : '6/2/2007' => this date within first week of June
'6/6/2007' => this date within second week of June

Thanks
nosepicker
New Member
New Member

--
21 Jun 2007 07:59 AM
See if this works for you:

DECLARE @date datetime
SET @date = '20070606'

SELECT
DATEPART(week, @date) -
DATEPART(week, DATEADD(month, DATEDIFF(month, 0, @date), 0))
+1
rosehcm2003
New Member
New Member

--
21 Jun 2007 05:45 PM
Thanks
You are not authorized to post a reply.

Acceptable Use Policy