instance method to_time

Ruby on Rails 2.2.3

Since v2.2.3 Last seen in v2.3.18

Available in: v2.2.3 v2.3.18

Signature

to_time()

Attempts to convert self to a Ruby Time object; returns self if out of range of Ruby Time class If self has an offset other than 0, self will just be returned unaltered, since there’s no clean way to map it to a Time

Source
# File activesupport/lib/active_support/core_ext/date_time/conversions.rb, line 74
        def to_time
          self.offset == 0 ? ::Time.utc_time(year, month, day, hour, min, sec) : self
        end

Defined in activesupport/lib/active_support/core_ext/date_time/conversions.rb line 74 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveSupport::CoreExtensions::DateTime::Conversions

Type at least 2 characters to search.

↑↓ navigate · open · esc close