Skip to content

Instantly share code, notes, and snippets.

@YenTheFirst
Created July 26, 2011 03:47
Show Gist options
  • Save YenTheFirst/1105918 to your computer and use it in GitHub Desktop.
Save YenTheFirst/1105918 to your computer and use it in GitHub Desktop.
WTF ActiveSupport::TimeZone
$ rails console
> a = Time.zone.now # => Mon, 25 Jul 2011 23:47:52 EDT -04:00
> b = Time.zone.parse(a.to_s) # => Mon, 25 Jul 2011 23:47:52 EDT -04:00
> c = Time.zone.parse(a.strftime("%Y-%m-%d %H:%M:%S.%N %z")) # => Mon, 25 Jul 2011 23:47:52 EDT -04:00
> a == b # => false
> a == c # => true
> a.nsec # => 583744338
> b.nsec # => 0
> c.nsec # => 583744338
# map != territory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment