Created
July 24, 2011 22:26
-
-
Save emmanuel/1103188 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
ruby-1.9.2-p180 :005 > dt1 = 1.year.ago.to_datetime | |
=> Sat, 24 Jul 2010 15:26:20 -0700 | |
ruby-1.9.2-p180 :006 > dt2 = DateTime.current | |
=> Sun, 24 Jul 2011 15:26:25 -0700 | |
ruby-1.9.2-p180 :007 > dt2 - dt1 | |
=> (31536004999579/86400000000) | |
ruby-1.9.2-p180 :008 > (dt2 - dt1).to_i | |
=> 365 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment