欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

写一个TimeUI显示的函数,上代码

程序员文章站 2022-08-29 09:19:18
public void FreshDateTime() { string strWeek = string.Empty; #region 格式化星期 switch (DateTime.Now.DayOfWeek) { case DayOfWeek.Sunday: strWeek = "星期日"; b ......

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;
}