Skip to content

Instantly share code, notes, and snippets.

@marclove
Created May 16, 2016 04:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marclove/41b531bf044ea2981f790f4ef4a199b4 to your computer and use it in GitHub Desktop.
Save marclove/41b531bf044ea2981f790f4ef4a199b4 to your computer and use it in GitHub Desktop.
require 'active_support'
def parse_time(time_string, zone)
old_tz = Time.zone
begin
Time.zone = zone
Time.zone.parse(time_string)
ensure
Time.zone = old_tz
end
end
parse_time('2007-02-10 15:30:45', 'Eastern Time (US & Canada)')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment