Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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