I have Customer XML with date-time fields but sometimes there are only dates. I need a result with only date-time fields and no date fields. (The xml I work with hat much more fields and is nested)
I thinks there is a better way then my brute force attempt.
xml = "<root><date>2003-07-15T10:00:00</date><enddate>2016-02-02</enddate><startdate>2000-02-10</startdate></root>";
string result = string.Empty;
if (!string.IsNullOrWhiteSpace(xml))
{
XDocument doc = XDocument.Parse(xml);
string xml1 = doc.ToString();
Regex rgx = new Regex(@">(\d{4}-\d\d-\d\d)</");
result = rgx.Replace(xml1, ">$1T00:00:00</");
}