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.
Author |
Topic |
astro26
Starting Member
1 Post |
Posted - 2009-02-05 : 07:39:43
|
Hi all,I need to do the following:I enter the Year and Week number as input parameters and as output I need the Start and End Dates.Eg. If the input parameters are 2009 (year) and 6 (week), the output must be 01/02/2009 and 07/02/2009.How can this be done. Any help greatly appreciated :)Thanks and Regards,Hari. |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-02-05 : 11:48:10
|
[code]DECLARE @Year int,@WeekNo intSELECT @Year=2009,@WeekNo=4SELECT DATEADD(wk,@WeekNo-1,DATEADD(yy,@Year-1900,0)) AS StartDate,DATEADD(wk,@WeekNo,DATEADD(yy,@Year-1900,0))-1 AS EndDate[/code] |
|
|
|
|
|