title: Convert String to Date Time
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1592653/convert-string-to-datetime-in-c">Convert string to DateTime in c#</a>  </p>
  </blockquote>
  
  
  
  <p>I am trying to convert a string in the format "20110617111051" to date time.
  Currently I am using String.SubString() function to extract year, month, day, time to format a standard string and then using Convert.ToDateTime(string). Is there any other simple way to do this?</p>
  
  <pre><code>Dim x as String="20110617110715"
  Dim standard as string = x.SubString(0,4) &amp; "-" &amp; x.SubString(4,2) &amp; "-" &amp; x.SubString(6,2) 'and time
  Dim dateTime as DateTime = Convert.ToDateTime(standard) 
  </code></pre>