Last active
October 10, 2015 12:38
-
-
Save voidlily/3691733 to your computer and use it in GitHub Desktop.
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
# incorrect | |
time = Time.zone.parse('2011-11-06T01:00:00') | |
=> Sun, 06 Nov 2011 01:00:00 PDT -07:00 | |
time.advance(hours: 1).beginning_of_hour | |
=> Sun, 06 Nov 2011 01:00:00 PDT -07:00 | |
# correct usage | |
time.utc.advance(hours: 1).change(min: 0).in_time_zone | |
=> Sun, 06 Nov 2011 01:00:00 PST -08:00 | |
# correct | |
time = Time.parse('2011-11-06T01:00:00') | |
=> 2011-11-06 01:00:00 -0500 | |
time.advance(hours: 1).beginning_of_hour | |
=> 2011-11-06 02:00:00 -0500 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment