var date = DateTime.Now; var m = (date.DayOfWeek == DayOfWeek.Sunday ? (DayOfWeek)7 : date.DayOfWeek) - DayOfWeek.Monday; var s = (date.DayOfWeek == DayOfWeek.Sunday ? (DayOfWeek)7 : date.DayOfWeek) - (DayOfWeek)7; var Mon = date.AddDays((-7 - m)); var Sun = date.AddDays((-7 - s));
来源:oschina
链接:https://my.oschina.net/u/4692982/blog/4950918