C#判断某日为一个星期的第几天
程序员文章站
2022-09-26 21:04:14
直接上代码: int DayinWeek = 0; string week = DateTime.Today.DayOfWeek.ToString(); #region 获取DayinWeek值 switch (week) { case "Monday": DayinWeek = 1; break; ......
直接上代码:
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; }