最近有些小忙,直接贴代码吧,
/// <summary> /// 获取系统的星期 /// </summary> /// <param name="dt">英文的星期</param> /// <returns>中文的星期几</returns> private static string GetWeek(string dt) { string week = ""; //根据取得的英文单词返回汉字 switch (dt) { case "Monday": week = "星期一"; break; case "Tuesday": week = "星期二"; break; case "Wednesday": week = "星期三"; break; case "Thursday": week = "星期四"; break; case "Friday": week = "星期五"; break; case "Saturday": week = "星期六"; break; case "Sunday": week = "星期日"; break; } return week; }‘ ’ static void Main(string[] args) { //获取当前是星期几,这里获取的是英文的星期几 string weekday = DateTime.Now.DayOfWeek.ToString(); Console.WriteLine(GetWeek(weekday)); }