111,120
社区成员
发帖
与我相关
我的任务
分享static DateTime StrToDateTime(string str)
{
Regex re=new Regex(@"\d{2}");
MatchCollection mc = re.Matches(str);
List<int> list = new List<int>();
foreach (Match m in mc)
list.Add(Convert.ToInt32(m.Value));
return new DateTime(list[0], list[1], list[2], list[3], list[4], list[5]);
} DateTime dt = StrToDateTime("091217 100226 ");
Console.WriteLine(dt.ToString("yy-MM-dd hh-mm-ss"));