Skip to content
instance method

Time#to_r

() -> ::Rational
to_r → rational

Returns the value of self as a Rational exact number of Epoch seconds;

Example
Time.now.to_r # => (16571402750320203/10000000)

Related: Time#to_f, Time#to_i.

See also #to_json #to_s #to_i #to_time also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0