Method: DateTime#localtime
- Defined in:
- activesupport/lib/active_support/core_ext/date_time/calculations.rb
#localtime(utc_offset = nil) ⇒ Object Also known as: getlocal
Returns a Time instance of the simultaneous time in the system timezone.
170 171 172 173 174 175 176 177 |
# File 'activesupport/lib/active_support/core_ext/date_time/calculations.rb', line 170 def localtime(utc_offset = nil) utc = new_offset(0) Time.utc( utc.year, utc.month, utc.day, utc.hour, utc.min, utc.sec + utc.sec_fraction ).getlocal(utc_offset) end |