写一个TimeUI显示的函数,上代码
public void freshdatetime()
{
string strweek = string.empty;
#region 格式化星期
switch (datetime.now.dayofweek)
{
case dayofweek.sunday:
strweek = "星期日";
break;
case dayofweek.monday:
strweek = "星期一";
break;
case dayofweek.tuesday:
strweek = "星期二";
break;
case dayofweek.wednesday:
strweek = "星期三";
break;
case dayofweek.thursday:
strweek = "星期四";
break;
case dayofweek.friday:
strweek = "星期五";
break;
case dayofweek.saturday:
strweek = "星期六";
break;
default:
strweek = string.empty;
break;
}
#endregion
this.labtimenow.text = datetime.now.tostring("yyyy-mm-dd hh:mm:ss ") + strweek;
}