tags:

views:

185

answers:

2

I need to calculate the date of the first day in a calendar week given a year/week, e.g.

Week 53 in 2009 -> Mon, 28.12.2009
Week 1 in 2010 -> Mon, 04.01.2010

How would you wirte that code?

PS: In the Gregorian calendar the first week of a year is the first week with 4 days.

A: 

If you don't want to do all the calculation yourself, use the System.Globalization.Calendar class. I think you can use the GetDayOfYear() method to get what you need.

Check this MSDN library for the example.

mqbt