Tuesday, July 3, 2012

Check Starting date of Current week and End date of current week.


DateTime dt = DateTime.Today;

                DateTime wkStDt = DateTime.MaxValue;

                DateTime wkEndDt = DateTime.MaxValue;

                wkStDt = dt.AddDays(1 - Convert.ToDouble(dt.DayOfWeek));

                wkEndDt = dt.AddDays(7 - Convert.ToDouble(dt.DayOfWeek));

                Page.Response.Write(wkStDt.ToString("MM/dd/yyyy") + "<br/>");

                Page.Response.Write(wkEndDt.ToString("MM/dd/yyyy"));

No comments:

Post a Comment