The DateTime.DayOfWeek property will give you an enum that ranges from 0
(Sunday) to 6 (Saturday). So you should be able to:
int DaysToStartOfWeek = (int) StartDate.DayOfWeek;
int DaysToEndOfWeek = (int)DayOfWeek.Saturday - (int)StartDate.DayOfWeek;
DateTime StartWeek = Today.Subtract(new TimeSpan(DaysToStartOfWeek,0,0,0));
DateTime EndWeek = Today.Add(new TimeSpan(DaysToEndOfWeek,0,0,0));
You'll have to mess around with it a bit if you wanted the date on Monday
for the start of the week and Sunday for the end of the week (just add one
to DaysToStartOfWeek and DaysToEndOfWeek)
"MFRASER" <mf*****@henwoodenergy.com> wrote in message
news:OB**************@TK2MSFTNGP11.phx.gbl...
If I have a date how can I find out the beginning of the week and the end
of the week?
System.DateTime StartDate = new DateTime(2003,10,29);
System.DateTime StartWeek = ?
System.DateTime EndWeek = ?