I’m creating an application to parse the xml provided by iTunes in C# and i’m having some issues with the fields ‘Date Added’ and ‘Date Modified’ which have this syntax:
2012-02-06T23:18:17Z
i’ve tried this:
DateModified = DateTime.ParseExact(s.Element("DateModified").ToString(), "yyyy-MM-ddTHH:mm:ssZ", System.Globalization.CultureInfo.InvariantCulture)
but the application fails with an FormatException
{"String was not recognized as a valid DateTime."}
I believe
s.Element("DateModified").ToString()is not outputting what you think it is.This works as expected: