instance method
to_datetime
Ruby on Rails 3.1.12
Since v3.0.20Signature
to_datetime()
No documentation comment.
Source
# File activesupport/lib/active_support/core_ext/string/conversions.rb, line 48
def to_datetime
return nil if self.blank?
d = ::Date._parse(self, false).values_at(:year, :mon, :mday, :hour, :min, :sec, :zone, :sec_fraction).map { |arg| arg || 0 }
d[5] += d.pop
::DateTime.civil(*d)
end
Defined in activesupport/lib/active_support/core_ext/string/conversions.rb line 48
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in String