Created
October 17, 2013 10:38
-
-
Save darkskiez/7022729 to your computer and use it in GitHub Desktop.
ruby time confusion
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
$ export TZ=MST | |
$ bundle exec rails c | |
ruby-1.9.3-p0 :001 > t = Time.new(2013, 1, 1, 0, 0, 0, "+00:00") | |
=> 2013-01-01 00:00:00 +0000 | |
ruby-1.9.3-p0 :002 > t + 1.day | |
=> 2013-01-02 00:00:00 -0700 | |
ruby-1.9.3-p0 :003 > t + 1.day.to_i | |
=> 2013-01-02 00:00:00 +0000 | |
ruby-1.9.3-p0 :004 > 1.day.object_id | |
=> 172801 | |
ruby-1.9.3-p0 :005 > 1.day.to_i.object_id | |
=> 172801 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment