C# - string 转为 DateTime(自定义)

上代码:

string dt = " 1  11 1961";            
DateTime day;
System.Globalization.DateTimeFormatInfo dtFormat = new System.Globalization.DateTimeFormatInfo();

dtFormat.ShortDatePattern = " M dyyyy";
day = Convert.ToDateTime(dt, dtFormat);

其中,格式表为:C#-日期格式表

posted @ 2015-01-06 14:24  wonkju  阅读(438)  评论(0编辑  收藏  举报