instance method
to_time
Ruby on Rails 3.0.20
Since v3.0.20Signature
to_time(form = :utc)
Form can be either :utc (default) or :local.
Parameters
-
formopt = :utc
Source
# File activesupport/lib/active_support/core_ext/string/conversions.rb, line 35
def to_time(form = :utc)
return nil if self.blank?
d = ::Date._parse(self, false).values_at(:year, :mon, :mday, :hour, :min, :sec, :sec_fraction).map { |arg| arg || 0 }
d[6] *= 1000000
::Time.send("#{form}_time", *d)
end
Defined in activesupport/lib/active_support/core_ext/string/conversions.rb line 35
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in String