Created
October 25, 2009 02:33
-
-
Save jamesgolick/217851 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import java.util.Date | |
| class FancyInteger(val integer: Int) { | |
| def day: Int = integer * 86400 | |
| def hour: Int = integer * 3600 | |
| def minute: Int = integer * 60 | |
| def ago: Date = new Date(System.currentTimeMillis() - integer * 1000) | |
| } | |
| implicit def int2FancyInt(integer: Int): FancyInteger = new FancyInteger(integer) | |
| 1.hour.ago | |
| 1.minute.ago |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment