首页 > 代码库 > C# 获取当前星期几
C# 获取当前星期几
private static string GetWeekName()
{
string weekName = "";
switch (DateTime.Now.DayOfWeek)
{
case DayOfWeek.Monday:
weekName = "周一";
break;
case DayOfWeek.Tuesday:
weekName = "周二";
break;
case DayOfWeek.Wednesday:
weekName = "周三";
break;
case DayOfWeek.Thursday:
weekName = "周四";
break;
case DayOfWeek.Friday:
weekName = "周五";
break;
case DayOfWeek.Saturday:
weekName = "周六";
break;
case DayOfWeek.Sunday:
weekName = "周日";
break;
}
return weekName;
}
C# 获取当前星期几