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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Get week range

Author  Topic 

oasis1
Starting Member

35 Posts

Posted - 2012-08-27 : 21:00:10
I am pulling pack the number of the week but want to display the weeks range value. I am able to get the numbers back how can I convert it to the date formatted range? mahalo, Mark

SELECT convert(varchar(5), DATEPART(wk, GETDATE())* 7) + '-' + convert(varchar(5), DATEPART(wk, GETDATE())* 7 + 6)

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-08-27 : 21:23:26
[code]
SELECT dateadd(wk,datediff(wk,0,getdate()),0) as weekstart,dateadd(wk,datediff(wk,0,getdate())+1,0)-1 as weekend
[/code]

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -