How do I get a date from the week number and year?

I need to get the date of the first day in a given week (Sunday is the 1st day of the week). I'm using VB.Net in Visual Studio 2005. For example, if I pass it week# 46 and the year 2008 I should get the date of Sunday, Nov. 9, 2008.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Christopher KileCommented:
This is problematic.  How do you want to handle week 1 if the year doesn't begin on a Sunday?
I'll assume that the first week of the year begins on the Sunday of that week.

Function DateOfThisWeek(ByVal weekNumber As Integer, ByVal year As Integer)
    Dim firstSunday As DateTime = DateTime.Parse(year & "/01/01").AddDays(-(DateTime.Parse(year & "/01/01").DayOfWeek))
    Return firstSunday.AddDays((weekNumber - 1) * 7.0)
End Function

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rkeith27Author Commented:
rkeith27Author Commented:
I'd handle the first week as the first 4 day week as week 1 with the start day of the week as Sunday.
Christopher KileCommented:
Yup, that's what I thought would work best.  I remember wrangling about it, though, more than once in different jobs.  Everyone has an opinion... :D
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.