title: Using DateTime.ParseExact On Aug 8, 2019 4:45:19 PM
body: <p>I am trying to use DateTime.ParseExact on the string of "Aug 8, 2019 4:45:19 PM". But every way that I have tried it, I am getting the error message of "String was not recognized as a valid DateTime".</p>
  
  <p>I've already tried using DateTime.Parse but it is giving me an inaccurate time back.</p>
  
  <p>It gives me:</p>
  
  <pre><code>08/08/2019 04:45:19 
  </code></pre>
  
  <p>instead of:</p>
  
  <pre><code>08/08/2019 16:45:19 
  </code></pre>
  
  <p>The code that I have so far is:</p>
  
  <pre><code>Import System.Globalization
  
  Dim dateTimeExample As DateTime = Nothing
  Dim format As String = "MMM d, yyyy h:mm:ss tt"
  Dim provider = CultureInfo.InvariantCulture
  Dim text As String = "Aug 8, 2019 4:45:19 PM"
  
  dateTimeExample = DateTime.ParseExact(text, format, provider)
  </code></pre>
  
  <p>The desired output I am looking for would be the DateTime of:</p>
  
  <pre><code>08-08-2019 16:45:19
  </code></pre>