Sergey
I thought this was working correctly, but for the month of June that has five weeks, it not quite right. I think it is a INT() or rounding issue, but not sure how to correct it, hoping you pull a little more from your knowledge
Declare @begintime datetime
set @begintime = '06/01/2007 00:00:00'
(DAY(@Begintime)-1)/7 + 1 as WeekOfMonth && Returns 1 which is correct
set @begintime = '06/04/2007 00:00:00'
(DAY(@Begintime)-1)/7 + 1 as WeekOfMonth && Returns 1 Also but this is should be 2
Thanks for any more help or pointers you could give me.
Kirk
>Try (not tested)
>SELECT (DATEPART(dd, @dt)-1)/7+1
>-- or
>SELECT (DAY(@dt)-1)/7 + 1
>Sergey
>
>You wouldn't happen to know how to do this in SQL Server 2000 as part of a select statement would you?
>
>Try
>
>? INT((DAY(ldDate)-1)/7) + 1