June 10, 2005 at 9:11 pm
This may be what you are looking for:
Select convert(char(10),getdate(),110) [current_date],
datediff(ww,dateadd(M, datediff(M, 0, getdate()), 0),getdate()) + 1 as [week_number]
current_date week_number
------------ -----------
06-10-2005 2
This code gets the number of weeks + 1 from the beginning of the month, 6/10/2005 in this case. You can test by substituting other dates for getdate().
All due credit to Frank Kalis. These two articles go a long way in explaining Sql Server dates and how to work with them.
June 11, 2005 at 7:27 am
hey..........thank u very much. this is what i wanted. and the two sites are very useful. really apprecite for ur help
Viewing 2 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply