Skip to content

Instantly share code, notes, and snippets.

@rsl
Forked from mrchrisadams/time_weirdness.rb
Created May 7, 2009 14:27
Show Gist options
  • Save rsl/108112 to your computer and use it in GitHub Desktop.
Save rsl/108112 to your computer and use it in GitHub Desktop.
>> e = DateTime.strptime('2009-05-07T01:33:23+01:00')
=> Thu, 07 May 2009 01:33:23 0100
>> f = DateTime.strptime('2009-05-06T23:33:23+01:00')
=> Wed, 06 May 2009 23:33:23 0100
>> e - f
=> Rational1, 12
>> a = Time.now
=> Thu May 07 10:25:53 -0400 2009
>> b = Time.now
=> Thu May 07 10:25:57 -0400 2009
>> b - a
=> 3.711893
>> a = User.first.created_at
=> Wed, 26 Nov 2008 00:10:44 UTC +00:00
>> b = User.last.created_at
=> Sat, 25 Apr 2009 06:32:05 UTC +00:00
>> b - a
=> 12982881.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment