VB.net 2010 视频教程 VB.net 2010 视频教程 python基础视频教程
SQL Server 2008 视频教程 c#入门经典教程 Visual Basic从门到精通视频教程
当前位置:
首页 > c#编程 >
  • C#判断某日为一个星期的第几天

直接上代码:

复制代码
 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;
            }
复制代码


相关教程