是不是有时候用DateTime.Parse()格式化时间会出错?
两种办法:
A:
CultureInfo culture = new CultureInfo("en-GB");
DateTime.Parse("30/06/2011", culture);
B:
DateTime.ParseExact("20110630","yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);
是不是有时候用DateTime.Parse()格式化时间会出错?
两种办法:
A:
CultureInfo culture = new CultureInfo("en-GB");
DateTime.Parse("30/06/2011", culture);
B:
DateTime.ParseExact("20110630","yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);
转载于:https://www.cnblogs.com/Cerberus/archive/2011/06/22/2087346.html