C#获取日期的星期名称
程序员文章站
2022-10-06 20:14:11
使用方式: ......
private string getweekname(dayofweek week) { string weekname = ""; switch (week) { case dayofweek.friday: weekname = "周五"; break; case dayofweek.monday: weekname = "周一"; break; case dayofweek.saturday: weekname = "周六"; break; case dayofweek.sunday: weekname = "周日"; break; case dayofweek.thursday: weekname = "周四"; break; case dayofweek.tuesday: weekname = "周二"; break; case dayofweek.wednesday: weekname = "周三"; break; default: break; } return weekname; }
使用方式:
getweekname(datetime.now.dayofweek),