String
\"2011-05-19 10:30:14\"
To
Thu May 19 10:30:14 UTC 2011
How can I convert specific string to this
<%= string_to_datetime("2011-05-19 10:30:14") %> def string_to_datetime(string,format="%Y-%m-%d %H:%M:%S") DateTime.strptime(string, format).to_time unless string.blank? end