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 |
|
vmon
Yak Posting Veteran
63 Posts |
Posted - 2004-07-08 : 12:20:48
|
| I need to output the Date for a year and week number. I am given 2004-28 which is week 28 of 2004. How can I turn that into the mm/dd/yyyy for the Monday of that week and year. I have tried datepart and getdate but they need a date and all I have is year and week.Thanks in advance,vmon |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2004-07-08 : 13:19:37
|
| Declare @curWeek intSet @curWeek = 28Select mondayOfWeek = dateadd(d, (@curWeek-1)*7, thisYear) - datepart(dw,thisYear) + 1, checkWeekNum = datepart(ww,dateadd(d, (@curWeek-1)*7, thisYear) - datepart(dw,thisYear) + 1)From ( Select thisYear = convert(Datetime,'1/1/' + convert(nvarchar,year(getdate()))) ) as ACorey |
 |
|
|
|
|
|