title: Convert string of date format to string of another date format
body: <p>I want to convert a string of date format to a string with another format.</p>
  
  <p>The string DateOfBirth could be in different formats such as:</p>
  
  <ul>
  <li>01/15/2017</li>
  <li>01-15-2017</li>
  <li>1.15.2017</li>
  <li>1.5.2017</li>
  </ul>
  
  <p>I want to convert it to another pattern that I get it as parameter.</p>
  
  <pre><code>public string ConvertStringDateFormat(string date, string convertToDateFormat)
  {
  }
  </code></pre>
  
  <p>Let's assume that date = "01/15/2017" and convertToDateFormat = "YYYY/MM/DD". How could I change it to the new format?</p>
  
  <p>The problem for me was to do it generic so that it will accept any parametrs.</p>
  
  <p>I thought that I can convert date to DateTime and then to use ToString with the format but can you offer any better idea?</p>