📅  最后修改于: 2022-03-11 14:48:52.591000             🧑  作者: Mango
public static DateTime FirstDayOfWeek(DateTime date)
{
DayOfWeek fdow = CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek;
int offset = fdow - date.DayOfWeek;
DateTime fdowDate = date.AddDays(offset);
return fdowDate;
}
public static DateTime LastDayOfWeek(DateTime date)
{
DateTime ldowDate = FirstDayOfWeek(date).AddDays(6);
return ldowDate;
}