using System; using System.Xml; class Program { static void Main() { string xml = "In this example, we create an XML string with a date element and pass it to an XmlTextReader object. We then use the ReadToFollowing method to move to the date element and ReadElementContentAsDateTime to read its content as a DateTime object. Finally, we print this value to the console. This method is part of the System.Xml package library, which is included by default in .NET Framework and .NET Core.2021-08-12T13:15:25 "; XmlTextReader reader = new XmlTextReader(new System.IO.StringReader(xml)); reader.ReadToFollowing("date"); DateTime date = reader.ReadElementContentAsDateTime(); Console.WriteLine(date); } }