I need to get the date of the first and last day of the week knowing the week number.
I get a start date and an end date, representing the first and last day of a selected week in a given year. then I need to get the start date and end date of the same week of the previous year to do a graphical comparison of some data.
I managed to get the week number based on the given start date and end date. Now I need to get the date of the first day and last day of the same week of the previous year. How could I do this quickest ?
EDIT: This is how I got the week number:
private int GetWeekNumber(DateTime date)
{
GregorianCalendar calendar = new GregorianCalendar(GregorianCalendarTypes.USEnglish);
return calendar.GetWeekOfYear(date, CalendarWeekRule.FirstDay, DayOfWeek.Sunday);
}