string dateString, format; DateTime result; CultureInfo provider = CultureInfo.InvariantCulture; // Parse date-only value with invariant culture. dateString = "20120726T063000Z"; format = "yyyyMMddThhmmssssZ"; result = DateTime.ParseExact(dateString, format, provider);
DateTime localDate = DateTime.ParseExact("20120726T063000Z","yyyyMMdd\\Thhmmss\\Z",System.Globalization.CultureInfo.InstalledUICulture); Console.WriteLine(localDate.ToString());
string strDate = "20120726T063000Z\r"; strDate = strDate.Replace("T", "").Replace("\r", "").Replace("Z", ""); DateTime MyDateTime; MyDateTime = new DateTime(); MyDateTime = DateTime.ParseExact(strDate, "yyyyMMddHHmmss", null);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)