Skip to content

Instantly share code, notes, and snippets.

@voidlily voidlily/gist:3691733
Last active Oct 10, 2015

Embed
What would you like to do?
# 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
You can’t perform that action at this time.