title: Formatting long datetime string to remove T character
body: <p>I have a number of XML nodes which output a datetime object as string. </p>
  
  <p>The problem is that when outputting both the time stamp and the date they are bonded together with a T Character. </p>
  
  <p>Here is an example</p>
  
  <blockquote>
    <p>2016-01-13T23:59:59</p>
  </blockquote>
  
  <p>Of course all of the nodes in the XML are of a different type so grouping by name or type is out of the question. Im thinking my only option is to match a pattern with regex and resolve the problem that way. </p>
  
  <p>Below is an example of how the XML would work, you can see that each element is named as something different but they all follow a similar pattern, where the T between the date and the time must be removed and a space replaced instead. </p>
  
  <pre><code>&lt;dates&gt;
      &lt;1stDate&gt; 2016-01-13T23:59:59 &lt;/1stdate&gt;
      &lt;2ndDate&gt; 2017-01-13T23:55:57 &lt;/2ndDate&gt;
      &lt;3rdDate&gt; 2018-01-13T23:22:19 &lt;/3rdDate&gt;
  &lt;/dates&gt;
  </code></pre>
  
  <p>Ideal solution to output like this</p>
  
  <pre><code>2016-01-13 23:59:59 
  2017-01-13 23:55:57 
  2018-01-13 23:22:19
  </code></pre>
  
  <p>I havent had to use Regex before but i know what it is. I have been trying to decode what this cheat sheet means <a href="http://regexlib.com/CheatSheet.aspx?AspxAutoDetectCookieSupport=1" rel="nofollow">http://regexlib.com/CheatSheet.aspx?AspxAutoDetectCookieSupport=1</a> but to no avail. </p>
  
  <p><strong>UPDATE</strong></p>
  
  <pre><code>//How each node is output
  foreach (XText node in nodes)
  {
      node.Value = node.Value.Replace("T"," "); // Where a date occurs, replace T with space. 
  }
  </code></pre>
  
  <p>The <code>&lt;date&gt;</code> elements provided in the example may contain dates in my XML but may not include the word date as a name. </p>
  
  <p>e.g. </p>
  
  <pre><code>&lt;Start&gt;  2017-01-13T23:55:57  &lt;/start&gt;
  &lt;End&gt;    2018-01-13T23:22:19  &lt;/End&gt;
  &lt;FirstDate&gt; 2018-01-13T23:22:19 &lt;/FirstDate&gt;
  </code></pre>
  
  <p>The main reason I would have liked a regex solution was because I need to match the date string with a pattern that can determine if its a date or not, then i can apply formatting.</p>