显示月份和星期的C#代码

private string[] weekDay = {“Sunday”,“Monday“,"Tuesday”,“Wednesday”,“Thursday”,“Friday”,“Saturday”};
private string[] Month = {“January ”,"February ","March ","April ","May","June ","July ","Aguest ","September ","October ","November ","December"};

private void Page_load(object sender,System.EventArgs e)
{
    if(!IsPostBack)
       {
            labelDate.Text=DateTime.now.ToShortDateString();
            int dayofWeek =(int)(DateTime.now.Dayofweek);
            lableweek.text = weekDay[dayofweek];
        }
}

你可能感兴趣的:(C#)