title: Convert YYYYMMDD string to MM/DD/YYYY string
body: <p>I have a date that is stored as a string in the format YYYYDDMM.  I would like to display that value in a 'MM/DD/YYYY' format. I am programming in c#. The current code that I am using is as follows:</p>
  
  <pre><code>txtOC31.Text = dr["OC31"].ToString().Trim();
  strOC31date = dr["OC31DATE"].ToString().Trim();
  DateTime date31 = DateTime.Parse(strOC31date);
  strOC31date = String.Format("{0:MM/dd/yyyy}", date31);
  </code></pre>
  
  <p>However, I am getting an error because the YYYYMMDD string (strOC31date) is not being recognized as a valid datetime. </p>