title: Find dates and change format in C#
body: <p>I have a text file with different data. Now I need to replace multiple things in the file, before I can use the data correctly. I have replaced texts with Regex. But now I need to change dates. But I can't figure out how to do that. </p>
  
  <p>The dates look like this: <code>"utc": "2017-10-02 19:55:00.205263000 Z"</code>
  And I want to get this result for all the occurences of this date format:
  <code>"utc": "2017-10-02 19:55:00"</code></p>
  
  <p>I tried to use following code:</p>
  
  <pre><code>string pattern = @"{0:yyyy-mm-dd hh:mm:ss.fff Z}";
  string replacement = "{0:yyyy-mm-dd hh:mm:ss";
  Regex rgx = new Regex(pattern);
  string result = rgx.Replace(theInputTextFile, replacement);
  </code></pre>
  
  <p>Is it not possible to use date formats with regular expressions. Or did I make a mistake in my code?</p>
  
  <p><a href="https://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx" rel="nofollow noreferrer">I used the information from here, for the date formats</a></p>