instance method
to_date
Ruby on Rails 3.1.12
Since v3.0.20 Last seen in v3.2.22.5Signature
to_date()
Converts a Time object to a Date, dropping hour, minute, and second precision.
my_time = Time.now # => Mon Nov 12 22:59:51 -0500 2007 my_time.to_date # => Mon, 12 Nov 2007 your_time = Time.parse("1/13/2009 1:13:03 P.M.") # => Tue Jan 13 13:13:03 -0500 2009 your_time.to_date # => Tue, 13 Jan 2009
Source
# File activesupport/lib/active_support/core_ext/time/conversions.rb, line 65
def to_date
::Date.new(year, month, day)
end
Defined in activesupport/lib/active_support/core_ext/time/conversions.rb line 65
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Time