c#字符串转时间

string str = "20100101120000";
            DateTime dt = DateTime.ParseExact(str, "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture);
            //DateTime dt = Tools.StringHelp.GetDateTime(str);
            Response.Write(dt.Year.ToString() + " , " + dt.Month.ToString() + " , "
                + dt.Day.ToString() + " , " + dt.Hour.ToString() + " , " + dt.Minute.ToString()
                + " , " + dt.Second.ToString());

你可能感兴趣的:(ParseExact)