Wednesday, February 18, 2009

Get start and end date of current week in C#



DayOfWeek day = DateTime.Now.DayOfWeek;
int days = day - DayOfWeek.Monday;
DateTime start = DateTime.Now.AddDays(-days);
DateTime end = start.AddDays(6);
Code from
http://www.codekeep.net/snippets/0d955fdd-ff9e-4403-90cb-15dac8391034.aspx

No comments: