title: C# Converting YYYY-MM-DD to MM/DD/YYYY ("-" TO "/")
body: <p>Hey I have been having trouble with something.</p>
  
  <pre><code>string record = el.InnerText;
  var result1 = parseString(record);
  var StartDate = string.Join("", result1.ConvertAll(r =&gt; string.Format("{0}", r)).ToArray());
  //DateTime strStartDate = DateTime.ParseExact(StartDate, "mm-dd-yyyy", CultureInfo.InvariantCulture);
  var EndDate = string.Join("", result1.ConvertAll(r =&gt; string.Format("{1}", r)).ToArray());
  //DateTime strEndDate = DateTime.ParseExact(EndDate, "mm-dd-yyyy", CultureInfo.InvariantCulture);
  </code></pre>
  
  <p>This is the <code>parseString</code> function:</p>
  
  <pre><code>private static List&lt;string[]&gt; parseString(string input)
      {
          var pattern = @"Start\s+Date:\s+([0-9-]+)\s+End\s+Date:\s+([0-9-]+)\s+(?:Warranty\s+Type:\s+\w+\s+)?Status:\s+(\w+)\s*";
          return Regex.Matches(input, pattern).Cast&lt;Match&gt;().ToList().ConvertAll(m =&gt; new string[] { m.Groups[1].Value, m.Groups[2].Value, m.Groups[3].Value });
      }
  </code></pre>
  
  <p>The <code>DateTimes</code> aren't working because I am <strong>guessing</strong> that "-" is not a valid character when converting a <code>string</code> to <code>DateTime</code>. </p>
  
  <p>I tried <code>record = record.Replace("-", "/")</code> but that ended up messing up my string and it stopped showing up (from html page).</p>