title: Parsing a string to date and time in Ruby?
body: <p>I have a string <code>"2011-05-19 10:30:14"</code> that I am trying to display as a date. I tried the following but it returns errors like "invalid date" and "arguments out of range" when I try:</p>
  
  <pre><code>"2011-05-19 10:30:14".to_date
  </code></pre>
  
  <p>And:</p>
  
  <pre><code>"2011-05-19 10:30:14".to_time
  </code></pre>
  
  <p>I also tried parsing with the DateTime class:</p>
  
  <pre><code>DateTime.parse("5-29-2013 10:17:04").
  </code></pre>
  
  <p>How do I get the date from this?</p>