convert String to DateTime convert String to DateTime ruby ruby

convert String to DateTime


Shouldn't this also work for Rails?

"30/Nov/2009 16:29:30 +0100".to_datetime


DateTime.strptime allows you to specify the format and convert a String to a DateTime.


I have had success with:

require 'time't = Time.parse(some_string)