Link to home
Start Free TrialLog in
Avatar of schuitkds
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
Avatar of Ephraim Wangoya
Ephraim Wangoya
Flag of United States of America image



select datename(week, getdate())

To change srtart of week to Monday you can use

SET DATEFIRST 1  --Monday
ASKER CERTIFIED SOLUTION
Avatar of Kalyanum Deepak Kumar
Kalyanum Deepak Kumar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial