My application receives date information from WMI. This is in the form of strings with the following format:
yyyymmddHHMMSS.mmmmmmsUUU
Read more about this format here . I am interested in disassembling everything before the period. I have the following code:
string testDate = "20010701212212"; // July, 01, 2001 21:22:12, in the format specified above string format = "yyyyMMddHHmmSS"; CultureInfo culture = CultureInfo.InvariantCulture; DateTime newDate = DateTime.ParseExact(date, format, culture);
This always happens when calling ParseExact (), which states that "String was not recognized as a valid DateTime." What am I doing wrong here?
c # datetime datetime-format
Odrade
source share