hi all, have a bug in my code regarding calculating current end of week. problem is when the month changes, my end week date gets corrupted.
private DateTime weekstartdate = DateTime.Today.AddDays(-(int)(DateTime.Today.DayOfWeek));
private DateTime weekenddate = DateTime.Today.AddDays(-(int)(DateTime.Today.DayOfWeek) + 6);
*** weekenddate ok here, shows 4/1/06
later in code, to get last day of week:
int day = DateTime.Today.Day;
int month = DateTime.Today.Month;
int year = DateTime.Today.Year;
startdate = new DateTime(year, month, weekstartdate.Day, 0, 0, 0);
** enddate = new DateTime(year, month, weekenddate.Day, 23, 59, 59, 997); **
**** but here enddate year is showing 2006, month 3, weekenddate=4/1/06 (correct) .Day = 1 (correct), 23, 59, 59, 997)
how can i correctly calculate weekend date when month changes, as it has with this week. my week is considered sunday midnight to saturday 11:59:59:997.
thanks in advanced