WInform怎样将时间变为某年某月某日某时,比如2015/7/27 15:13:22 变为2015年7月27日15时?
static void Main(string[] args)
{
String s1 = "2015/7/27 15:13:22";
DateTime dt = DateTime.Parse(s1);
String s2 = dt.ToString("yyyy年M月d日H时");
Console.WriteLine(s2);
Console.ReadLine();
}
输出
2015年7月27日15时
new DateTime().Parse("2015/7/27 15:13:22").ToString("yyyy年m月d日h时");
像这个格式化各种语句都会有format的吧
http://www.cnblogs.com/jianglan/archive/2011/08/22/2149834.html