<gi***@gmx.de> wrote in message news:ej**************@tk2msftngp13.phx.gbl...
Hi!!
know someone how to get a week span with week number and year?
something like hi:
public static DateTime[] GetWeekSpan(int weekNumber, int year)
{
DateTime weekStartDate = new DateTime();
DateTime weekEndDate = new DateTime();
//do something to find the sweek span!!!!
DateTime[] currentWeekSpan = new DateTime[2];
currentWeekSpan[0] = weekStartDate;
currentWeekSpan[1] = weekEndDate;
return currentWeekSpan;
}
any ideas???
regards,
gicio
Basically you need to find the startdate of a particular week. This depends
on the particular locale (for instance: in the Netherlands week 1 of 2004 starts
at monday, december 29, 2003 and week 1 of 2005 is jan 3, 2005)
Maybe you could try the following:
- find the startday of week 1 of the year
- first day is sunday or monday (or other?)
- week 1 could be "includes jan 1", "first full week", "at least 4 days", ...
- add the number of weeks (minus one, as the numbering starts at 1)
Hans Kesting