title: Ruby on Rails invalid date error when parsing datetime string to convert to a different format
body: <p>In my Rails App (Rails 2.3.14 and  Ruby 1.8.7) I am trying to convert a datetime string into a different format to perform a search on my MySQL database but I am getting an  <code>invalid date</code> error and I can't seem to figure out why, I've read a good few similar questions but I still can't seem to resolve the issue.</p>
  
  <pre><code># check if filter contains a time stamp
  if params[:sSearch].include?('/') and params[:sSearch].include?(':')
    datetime = DateTime.strptime(params[:sSearch], "%Y-%m-%d %H:%M")
    params[:sSearch] = datetime
  end
  </code></pre>
  
  <p>Example scenario</p>
  
  <pre><code>04/11/13 16:14
  </code></pre>
  
  <p>should convert to</p>
  
  <pre><code>2013-11-04 16:14
  </code></pre>
  
  <p>I thought it might have been to do with the fact that the seconds aren't included in the front-end representation of the string as the precise <code>datetime</code> in the database table is <code>2013-11-04 16:14:52</code> so I included the seconds now but still getting the same error and I don't think that should matter since I am using the <code>LIKE</code> operand with wildcards on either side of the search term, so even without the seconds it should work.</p>