Dear All, Could you help me, i want to get the number of week in a month example when the day is Friday Jan, 2, 2009 I get the value 1 (or the first week) when the day is Tue Jan, 6, 2009 i get the value 2 ( or the second week). Thanks & Regards Rudianto.
This really depends on how you define "week", but this should get on going: DECLARE @TheDate datetime; SELECT @TheDate = '2009-01-06'; SELECT DATEDIFF (week, DATEADD (m, DATEDIFF (m, 0, @TheDate), 0), @TheDate) + 1