Define a function as:
private DateTime GetDateByWeekAndYear(int year, int WeekNo)
{
DateTime dt = new DateTime(year, 1, 1);
CultureInfo ci = CultureInfo.CurrentCulture;
dt = ci.Calendar.AddWeeks(dt, WeekNo);
return dt;
}
Call the method by passing year and week no
DateTime dt = GetDateByWeekAndYear(2011,25);
Here is the another way to implement the method:
private DateTime GetDateByWeekAndYear(int year, int WeekNo)
{
DateTime dt = new DateTime(year, 1, 1);
while (dt.DayOfWeek != DayOfWeek.Monday)
{
dt = dt.AddDays(1);
}
dt = dt.AddDays((WeekNo - 2) * 7);
return dt;
}