title: How to convert any date format to yyyy-MM-dd
body: <p>My app parses a string data, extracts the date and identify the format of the date and convert it to yyyy-MM-dd.</p>
  
  <p>The source date could be anything lime dd-mm-yyyy, dd/mm/yyyy, mm-dd-yyyy, mm/dd/yyyy or even yyyy-MM-dd.</p>
  
  <p>Other than attempting different permutations and combinations using switch case, is there any other efficient way to do it?</p>
  
  <pre><code>string sourceDate = "31-08-2012";
  String.Format("{0:yyyy-MM-dd}", sourceDate);
  </code></pre>
  
  <p>The above code simply returns the same sourceDate "31-08-2012".</p>