Created
January 16, 2012 01:41
-
-
Save anonymous/1618523 to your computer and use it in GitHub Desktop.
Subtracting dates
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
birth = Time.utc(2011, "aug", 24) | |
now = Time.now | |
age = now - birth | |
output = 'Tom was born on ' + birth.strftime("%m/%d/%Y") | |
output += "<br/> She is " + age | |
return output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment