Skip to content

Instantly share code, notes, and snippets.

@jamesgolick
Created October 25, 2009 02:33
Show Gist options
  • Select an option

  • Save jamesgolick/217851 to your computer and use it in GitHub Desktop.

Select an option

Save jamesgolick/217851 to your computer and use it in GitHub Desktop.
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