最傻的一种:
string WeekDay = "";
switch (date.DayOfWeek)
{
case DayOfWeek.Monday:
WeekDay = "星期一";
break;
case DayOfWeek.Friday:
WeekDay = "星期五";
break;
case DayOfWeek.Saturday:
WeekDay = "星期六";
break;
case DayOfWeek.Sunday:
WeekDay = "星期日";
break;
case DayOfWeek.Thursday:
WeekDay = "星期四";
break;
case DayOfWeek.Tuesday:
WeekDay = "星期二";
break;
case DayOfWeek.Wednesday:
WeekDay = "星期三";
break;
}
第二傻:
string [] Day=new string []{"星期日","星期一","星期二","星期三","星期四","星期五","星期六"};
Console.WriteLine(Day[Convert.ToInt16(DateTime.Now.DayOfWeek)]);
再次
const string Day = "日一二三四五六";
Console.WriteLine("星期" + Day[Convert.ToInt16(DateTime.Now.DayOfWeek)]);
最后
System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(DateTime.Now.DayOfWeek)
string WeekDay = "";
switch (date.DayOfWeek)
{
case DayOfWeek.Monday:
WeekDay = "星期一";
break;
case DayOfWeek.Friday:
WeekDay = "星期五";
break;
case DayOfWeek.Saturday:
WeekDay = "星期六";
break;
case DayOfWeek.Sunday:
WeekDay = "星期日";
break;
case DayOfWeek.Thursday:
WeekDay = "星期四";
break;
case DayOfWeek.Tuesday:
WeekDay = "星期二";
break;
case DayOfWeek.Wednesday:
WeekDay = "星期三";
break;
}
第二傻:
string [] Day=new string []{"星期日","星期一","星期二","星期三","星期四","星期五","星期六"};
Console.WriteLine(Day[Convert.ToInt16(DateTime.Now.DayOfWeek)]);
再次
const string Day = "日一二三四五六";
Console.WriteLine("星期" + Day[Convert.ToInt16(DateTime.Now.DayOfWeek)]);
最后
System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(DateTime.Now.DayOfWeek)