instance method
to_datetime
Ruby on Rails 8.0.4
Since v2.2.3Signature
to_datetime()
Returns an instance of DateTime with the timezone’s UTC offset
Time.zone.now.to_datetime # => Tue, 18 Aug 2015 02:32:20 +0000 Time.current.in_time_zone('Hawaii').to_datetime # => Mon, 17 Aug 2015 16:32:20 -1000
Source
# File activesupport/lib/active_support/time_with_zone.rb, line 486
def to_datetime
@to_datetime ||= utc.to_datetime.new_offset(Rational(utc_offset, 86_400))
end
Defined in activesupport/lib/active_support/time_with_zone.rb line 486
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::TimeWithZone