instance method
to_datetime
Ruby on Rails 2.2.3
Since v2.2.3 Last seen in v2.3.18Available in: v2.2.3 v2.3.18
Signature
to_datetime()
Converts a Date instance to a DateTime, where the time is set to the beginning of the day and UTC offset is set to 0.
Example:
date = Date.new(2007, 11, 10) # => Sat, 10 Nov 2007 date.to_datetime # => Sat, 10 Nov 2007 00:00:00 0000
Source
# File activesupport/lib/active_support/core_ext/date/conversions.rb, line 97
def to_datetime
::DateTime.civil(year, month, day, 0, 0, 0, 0)
end
Defined in activesupport/lib/active_support/core_ext/date/conversions.rb line 97
· View on GitHub
· Improve this page
· Find usages on GitHub