.NET Get the First and Last Day of the Week

By SP

Try following to get the first and last day of the week using current date.

DateTime Day_Today = DateTime.Today;
DateTime
Day_First = Day_Today.AddDays(1 - Day_Today.DayOfWeek.GetHashCode());
DateTime
Day_Last = Day_Today.AddDays(7 - Day_Today.DayOfWeek.GetHashCode());

Hope this helps.

.NET Get the First and Last Day of the Week  (2889 Views)