C# 将string字符转换成DateTime

string BoxCode = "X20171215090101";
DateTime t = DateTime.ParseExact(BoxCode.Substring(1, 14), "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture).AddDays(-i);
原文地址:https://www.cnblogs.com/wsxkit/p/10907535.html