Skip to content

Instantly share code, notes, and snippets.

@norman
Last active December 12, 2015 01:38
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 norman/4692592 to your computer and use it in GitHub Desktop.
Save norman/4692592 to your computer and use it in GitHub Desktop.
require "rubygems"
require "tzinfo"
input = '1/31/13 13:34'
format = '%m/%d/%y %H:%M'
zone = TZInfo::Timezone.get('America/Los_Angeles')
local = DateTime.strptime(input, format)
utc = zone.local_to_utc(local)
output = utc.iso8601
puts output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment