









1.这是一种最笨的方法
int i=(int)DateTime.Today.DayOfWeek;
switch(i)
{
case 0:
txtDate.Text="星期天";
break;
case 1:
txtDate.Text="星期一";
break;
case 2:
txtDate.Text="星期二";
break;
case 3:
txtDate.Text="星期三";
break;
case 4:
txtDate.Text="星期四";
break;
case 5:
txtDate.Text="星期五";
break;
……………………
}
2.聪明的方法:
string strWeek = "星期"+"日一二三四五六".Substring((int)System.DateTime.Now.DayOfWeek,1);
3.最好的方法:
string dateString = System.DateTime.Today.ToString("yyyy-M-d dddd", new System.Globalization.CultureInfo("zh-CN"));
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。