Class: ActiveSupport::TimeWithZone
- Inherits:
-
Object
- Object
- ActiveSupport::TimeWithZone
- Defined in:
- lib/hackapp_gem.rb
Instance Method Summary collapse
Instance Method Details
#change_timezone(options) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/hackapp_gem.rb', line 5 def change_timezone() zones = {"eastern" => "-0500", "central" => "-0600", "mountain" => "-0700", "pacific" => "-0800"} begin end_zone_offset = zones[[:new_timezone]] self.to_datetime.change(:offset => end_zone_offset) rescue Exception => e puts "Unrecognizeable timezone, please use either 'eastern', 'central', 'mountain', or 'pacific' #{e}" end end |