Skip to content

Instantly share code, notes, and snippets.

@luckyruby
Last active August 29, 2015 13:57
Show Gist options
  • Save luckyruby/9774974 to your computer and use it in GitHub Desktop.
Save luckyruby/9774974 to your computer and use it in GitHub Desktop.
Module Utility
class << self
def to_time_with_zone(timezone, date, hour, minute)
old_time_zone = Time.zone
Time.zone = timezone
Time.zone.parse("#{date} #{hour}:#{minute}")
ensure
Time.zone = old_time_zone
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment