很簡單的代碼orm
string dateTimeStr = "2010-5-27 13:47:16";input
DateTime dateTime;string
Console.WriteLine("input:" + dateTimeStr);it
Console.WriteLine("Convert:" + Convert.ToDateTime(dateTimeStr)); date
if (DateTime.TryParseExactim
(dateTimeStr, new []{"yyyy-MM-dd HH:mm:ss","yyyy-M-dd HH:mm:ss"}, new CultureInfo("zh-CN").DateTimeFormat, DateTimeStyles.AllowInnerWhite,out dateTime))new
{
Console.WriteLine("output:" + dateTime);
}
Console.WriteLine("finish");