CSharp examples for System.Xml:XML Element
Get Date Time from XmlElement
using System.Xml; using System.Text; using System.Collections.Generic; using System;//from ww w . java2 s .c o m public class Main{ public static DateTime GetDateTime(XmlElement source, string childName) { string txt = GetText(source, childName); return string.IsNullOrEmpty(txt) ? DateTime.MinValue : DateTime.Parse(childName); } public static DateTime GetDateTime(XmlElement source, string childName, IFormatProvider formatProvider) { string txt = GetText(source, childName); return string.IsNullOrEmpty(txt) ? DateTime.MinValue : DateTime.Parse(txt, formatProvider); } }