Skip to content

Instantly share code, notes, and snippets.

@larzconwell
Created March 17, 2012 21:02
Show Gist options
  • Save larzconwell/2065249 to your computer and use it in GitHub Desktop.
Save larzconwell/2065249 to your computer and use it in GitHub Desktop.
Used in my Rails app to create a DateTime object with the user's utc offset
require 'date'
time = Time.new(2012,5,1,10,30)
date = DateTime.parse(time.to_s)
puts date
#=> 2012-03-02T10:30:00-05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment