WinForm如何输出中文星期几?
在C#的WinForm开发中,使用DateTime.Now.DayOfWeek输出星期时,都是英文的,如何输出中文呢?其实很简单,下面的的一个小小的函数即可实现:
public static string WeekDayOfCN(DateTime dt)
{
string[] arrCnNames = new string[] { "日", "一", "二", "三", "四", "五", "六" };
return "星期" + arrCnNames[(int)dt.DayOfWeek];
}
public static string WeekDayOfCN(DateTime dt)
{
string[] arrCnNames = new string[] { "日", "一", "二", "三", "四", "五", "六" };
return "星期" + arrCnNames[(int)dt.DayOfWeek];
}