Method: ActiveSupport::TimeZone#utc_to_local
- Defined in:
- activesupport/lib/active_support/values/time_zone.rb
permalink #utc_to_local(time) ⇒ Object
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.
533 534 535 536 537 538 |
# File 'activesupport/lib/active_support/values/time_zone.rb', line 533 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 |