C#中指定的日期的星期如何实现?

来源:百度知道 编辑:UC知道 时间:2024/05/24 20:26:59

DateTime d = Convert.ToDateTime("2007-11-16");
Response.Write(d.DayOfWeek.ToString());

中文

DateTime d = Convert.ToDateTime("2007-11-16");
System.Globalization.CultureInfo cultureInfo = new System.Globalization.CultureInfo("zh-CN");

Response.Write("星期"+cultureInfo.DateTimeFormat.GetAbbreviatedDayName(d.DayOfWeek).ToString());

DateTime d = Convert.ToDateTime("2007-11-16");
Console.Write(d.DayOfWeek.ToString());
Console.Write("周" + ((int)d.DayOfWeek).ToString());

DateTime.DayOfWeek