instance method to_time_in_current_zone

Ruby on Rails 3.1.12

Since v3.0.20 Last seen in v4.0.13

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

Signature

to_time_in_current_zone()

Converts Date to a TimeWithZone in the current zone if Time.zone or Time.zone_default is set, otherwise converts Date to a Time via Date#to_time

Source
# File activesupport/lib/active_support/core_ext/date/zones.rb, line 7
  def to_time_in_current_zone
    if ::Time.zone
      ::Time.zone.local(year, month, day)
    else
      to_time
    end
  end

Defined in activesupport/lib/active_support/core_ext/date/zones.rb line 7 · View on GitHub · Improve this page · Find usages on GitHub

Defined in Date

Type at least 2 characters to search.

↑↓ navigate · open · esc close