Skip to content

Instantly share code, notes, and snippets.

@jamesgolick
Created November 16, 2009 19:55
Show Gist options
  • Select an option

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

Select an option

Save jamesgolick/236274 to your computer and use it in GitHub Desktop.
package journalist
import java.util.Date
object FancyInt {
implicit def int2FancyInt(int: Int): FancyInt = new FancyInt(int)
}
class FancyInt(val integer: Int) {
def day: Int = integer * 86400
def days: Int = day
def hour: Int = integer * 3600
def hours: Int = hour
def minute: Int = integer * 60
def minutes: Int = minute
def ago: Date = new Date(System.currentTimeMillis() - integer * 1000)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment