Skip to content

Instantly share code, notes, and snippets.

@charroch
Created April 10, 2011 13:40
Show Gist options
  • Save charroch/912350 to your computer and use it in GitHub Desktop.
Save charroch/912350 to your computer and use it in GitHub Desktop.
import java.text.SimpleDateFormat
import java.util.Date
class RichHumanDate(d:Long) {
def toHumanString() = {
val sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss.SSS");
val dt = new Date(d);
sdf.format(dt);
}
}
object RichHumanDate {
implicit def longToHumanReadable(d: Long) = new RichHumanDate(d)
}
import RichHumanDate._
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment