title: Leading Zero Date Format C#
body: <p>I have this function...</p>
  
  <pre><code>private string dateConvert(string datDate)
  {
          System.Globalization.CultureInfo cultEnGb = new System.Globalization.CultureInfo("en-GB");
          System.Globalization.CultureInfo cultEnUs = new System.Globalization.CultureInfo("en-US");
  
          DateTime dtGb = Convert.ToDateTime(datDate, cultEnGb.DateTimeFormat);
          datDate = dtGb.ToString(cultEnUs.DateTimeFormat.ShortDatePattern);
  
          return datDate;
  }
  </code></pre>
  
  <p>But I want it with the leading zero still on lower digits (1-9) so the date is 11-09-2009 (mm-dd-yyyy)...</p>
  
  <p>Now If I wasn't converting it id use string.Format("{0:d}", dateVar) how do I do this in the conversion?</p>
  
  <p><b>***** Solution *****</b><br><br>
  Used a slightly modified version of the answer below (i.e. one that would render).</p>
  
  <pre><code>Convert.ToDateTime(datDate).ToString("MM-dd-yyyy");
  </code></pre>