Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Converting Date to a Week number

Author  Topic 

LMartin
Starting Member

2 Posts

Posted - 2010-05-19 : 10:08:20
Can anyone tell me how to convert a date to a week number? (i.e. 5/18/2010 is week 20)

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-05-19 : 10:16:44

select datepart(week,'5/18/2010')

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

LMartin
Starting Member

2 Posts

Posted - 2010-05-19 : 11:16:54
Will that still work if we are running a query and we are trying to convert all the dates to a week number so that we can then subtotal by week number?
Go to Top of Page

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2010-05-19 : 11:28:38
Yes it will. Did you try?
Go to Top of Page
   

- Advertisement -