Skip to content

Instantly share code, notes, and snippets.

@bwmcadams
Created November 22, 2011 14:44
Show Gist options
  • Save bwmcadams/1385814 to your computer and use it in GitHub Desktop.
Save bwmcadams/1385814 to your computer and use it in GitHub Desktop.
trait JodaDateTimePrimitive extends BSONDatePrimitive[DateTime] {
def rawValue(bson: Long): DateTime = {
new DateTime(bson)
}
def bsonValue(raw: DateTime): Long = {
raw.getMillis
}
}
trait JDKDatePrimitive extends BSONDatePrimitive[java.util.Date] {
def rawValue(bson: Long): java.util.Date = {
new java.util.Date(bson)
}
def bsonValue(raw: java.util.Date): Long = {
raw.getTime
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment