C# 获取中文星期的两种方法
//方法一 public string Week() { string[] weekdays = { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" }; string week = weekdays[Convert.ToInt32(DateTime.Now.DayOfWeek)]; return week; } //方法二 string weekstr = DateTime.Now.DayOfWeek.ToString(); switch (weekstr) { case "Monday": weekstr = "星期一"; break; case "Tuesday": weekstr = "星期二"; break; case "Wednesday": weekstr = "星期三"; break; case "Thursday": weekstr = "星期四"; break; case "Friday": weekstr = "星期五"; break; case "Saturday": weekstr = "星期六"; break; case "Sunday": weekstr = "星期日"; break; }
设计