This does not depend on any setting of datefirst or language:select a.DT, DateWanted = dateadd(dd,datediff(dd,0,a.DT),0)+ case datediff(dd,-53690,a.DT)%7 when 0 then -3 when 6 then -2 else -1 end, DayOfWeek = datename(dw,a.DT)from (-- Test Dates select DT = getdate() union all select DT = getdate()+1 union all select DT = getdate()+2 union all select DT = getdate()+3 union all select DT = getdate()+4 union all select DT = getdate()+5 union all select DT = getdate()+6 union all select DT = getdate()+7 ) aorder by a.DT
Results:DT DateWanted DayOfWeek----------------------- ----------------------- ----------2011-08-23 11:07:22.217 2011-08-22 00:00:00.000 Tuesday2011-08-24 11:07:22.217 2011-08-23 00:00:00.000 Wednesday2011-08-25 11:07:22.217 2011-08-24 00:00:00.000 Thursday2011-08-26 11:07:22.217 2011-08-25 00:00:00.000 Friday2011-08-27 11:07:22.217 2011-08-26 00:00:00.000 Saturday2011-08-28 11:07:22.217 2011-08-26 00:00:00.000 Sunday2011-08-29 11:07:22.217 2011-08-26 00:00:00.000 Monday2011-08-30 11:07:22.217 2011-08-29 00:00:00.000 Tuesday
CODO ERGO SUM