title: Rescuing an invalid date in a rails controller
body: <p>I have this in a controller:</p>
  
  <pre><code>pickuptime = params[:appointment][:pickuptime]
  pickuptime = DateTime.strptime(pickuptime, "%m/%d/%Y %l:%M %p %Z")
  </code></pre>
  
  <p>I would like to <code>rescue</code> it if <code>DateTime.strptime</code> kicks back an <code>Invalid Date</code> error and redirect it back to the previous page with the flash message 'Invalid date'. How can I accomplish this?</p>
  
  <p>I am using Ruby 2.1.2 and Rails 4.1.4. Thanks!</p>