直接上代码:
int DayinWeek = 0; string week = DateTime.Today.DayOfWeek.ToString(); #region 获取DayinWeek值 switch (week) { case "Monday": DayinWeek = 1; break; case "Tuesday": DayinWeek = 2; break; case "Wednesday": DayinWeek = 3; break; case "Thursday": DayinWeek = 4; break; case "Friday": DayinWeek = 5; break; case "Saturday": DayinWeek = 6; break; case "Sunday": DayinWeek = 7; break; }