Class: Time

Inherits:
Object
  • Object
show all
Defined in:
lib/world_time/extention/time.rb

Instance Method Summary collapse

Instance Method Details

#timezone(timezone = 'UTC') ⇒ Object



2
3
4
5
6
7
8
9
# File 'lib/world_time/extention/time.rb', line 2

def timezone(timezone = 'UTC')
  old = ENV['TZ']
  utc = self.dup.utc
  ENV['TZ'] = timezone
  output = utc.localtime
  ENV['TZ'] = old
  output
end