Created
March 17, 2012 21:02
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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