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
 Convert Weeknum to dates

Author  Topic 

etcellm
Starting Member

1 Post

Posted - 2008-06-01 : 22:26:56

Is there a way to convert a weeknumber to a start of week and end of week date? If so, can you please point me in the right direction.
Looking forward to your reply
Regards

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-02 : 00:24:51
[code]DECLARE @WeekNo int,@Financial_year varchar(4),@StartWeekDate datetime,@EndWeekDate datetime


SELECT @StartWeekDate=DATEADD(dd,-1 * (DATEPART(dw,DATEADD(wk,@WeekNo,CAST(@Financial_year as datetime)))-1) , DATEADD(wk,@WeekNo,CAST(@Financial_year as datetime)))

SELECT @EndWeekDate= DATEADD(dd,6,@StartWekDate)


where @WeekNo & @Financial_Year are params holding input values from user[/code]
Go to Top of Page
   

- Advertisement -