instance method
utc_to_local
Ruby on Rails 7.2.3
Since v2.2.3Signature
utc_to_local(time)
Adjust the given time to the simultaneous time in the time zone represented by self. Returns a local time with the appropriate offset – if you want an ActiveSupport::TimeWithZone instance, use Time#in_time_zone() instead.
As of tzinfo 2, utc_to_local returns a Time with a non-zero utc_offset. See the utc_to_local_returns_utc_offset_times config for more info.
Parameters
-
timereq
Source
# File activesupport/lib/active_support/values/time_zone.rb, line 544
def utc_to_local(time)
tzinfo.utc_to_local(time).yield_self do |t|
ActiveSupport.utc_to_local_returns_utc_offset_times ?
t : Time.utc(t.year, t.month, t.day, t.hour, t.min, t.sec, t.sec_fraction * 1_000_000)
end
end
Defined in activesupport/lib/active_support/values/time_zone.rb line 544
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::TimeZone