C#判断某日为一个星期的第几天
程序员文章站
2022-05-03 22:59:50
直接上代码: 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; }
上一篇: 毛笋和冬笋是一样的吗