schuitkds
asked on
SQL determine WeekNo of a date.
Hello
I am looking to determine what week of the year a date falls in.
what I am running into is Sunday appears to be calculated as first day of the week
is there a way I can change this to Monday being first day of the week as we search for transactions on the work week monday to sunday.
right now if i want to search for data 10 wks ago based on beginning and ending dates
ex: 04-25-2011 to 05-01-2011, 05-01-2011 is sunday and is a diff week no than 04-25-2011
I am looking to determine what week of the year a date falls in.
what I am running into is Sunday appears to be calculated as first day of the week
is there a way I can change this to Monday being first day of the week as we search for transactions on the work week monday to sunday.
right now if i want to search for data 10 wks ago based on beginning and ending dates
ex: 04-25-2011 to 05-01-2011, 05-01-2011 is sunday and is a diff week no than 04-25-2011
To change srtart of week to Monday you can use
SET DATEFIRST 1 --Monday
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
select datename(week, getdate())