instance method to_datetime

Ruby on Rails 3.2.22.5

Since v3.0.20 Last seen in v3.2.22.5

Available in: v3.0.20 v3.1.12 v3.2.22.5

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.

Examples

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 93
  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 93 · View on GitHub · Improve this page · Find usages on GitHub

Defined in Date

Type at least 2 characters to search.

↑↓ navigate · open · esc close