instance method to_f

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_f()

Converts self to a floating-point number of seconds since the Unix epoch

Source
# File activesupport/lib/active_support/core_ext/date_time/conversions.rb, line 89
        def to_f
          days_since_unix_epoch = self - ::DateTime.civil(1970)
          (days_since_unix_epoch * 86_400).to_f
        end

Defined in activesupport/lib/active_support/core_ext/date_time/conversions.rb line 89 · 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