I’m using itextsharp to extract the modified date from a pdf file. The string gets returned in this format: D:20120224093340. I’m trying to parse that string into a date time like so:
string modDate = "";
reader.Info.TryGetValue("ModDate", out modDate);
System.Globalization.CultureInfo provider =
System.Globalization.CultureInfo.InvariantCulture;
pdfModDate = DateTime.ParseExact(formattedDate, "D:yyyyddMMHHmmss", provider);
But I get this error message: The DateTime represented by the string is not supported in calendar System.Globalization.GregorianCalendar.
I have no idea what this error means. This code should be working…
Your month is 24, which is not supported by the Gregorian calendar 🙂