回复 1# fighter19 的帖子
static void Main(string[] args)
{
DateTime dt=DateTime.Now;
string s= dt.GetDateTimeFormats('D')[0].ToString();
//string s1 = dt.GetDateTimeFormats('t')[0].ToString();
string s1 = dt.ToShortTimeString().ToString();
Console.WriteLine(s);
Console.WriteLine(s1);
string s2 = dt.DayOfWeek.ToString ();
switch (s2)
{
case "Monday":
{ Console.WriteLine("星期一");
break;
}
case "Tuesday":
{ Console.WriteLine("星期二");
break;
}
case "Wednesday":
{ Console.WriteLine("星期三");
break;
}
case "Thursday":
{ Console.WriteLine("星期四");
break;
}
case "Friday":
{ Console.WriteLine("星期五");
break;
}
case "Saturday":
{ Console.WriteLine("星期六");
break;
}
case "Sunday":
{ Console.WriteLine("星期日");
break;
}