Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mpcjanssen/0692427eaff00e65949ded859ba511ac to your computer and use it in GitHub Desktop.
Save mpcjanssen/0692427eaff00e65949ded859ba511ac to your computer and use it in GitHub Desktop.
implicit class BetterDate(x: Date){
def yesterday: Date = {
val y = new Date(x.getTime)
y.setDate(-1)
y
}
}
val today = new Date()
val yesterday: Date = today.yesterday
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment