Skip to content
instance method

Date#to_time

() -> ::Time
to_time → time

Returns a new Time object with the same value as self; if self is a Julian date, derives its Gregorian date for conversion to the Time object:

Example
Date.new(2001, 2, 3).to_time               # => 2001-02-03 00:00:00 -0600
Date.new(2001, 2, 3, Date::JULIAN).to_time # => 2001-02-16 00:00:00 -0600
See also #to_s #tuesday? #to_json #upto also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0