Skip to content

Instantly share code, notes, and snippets.

@banjeremy
Created April 9, 2017 21:08
Show Gist options
  • Save banjeremy/084cf240069a0e89519b362344cdbb6a to your computer and use it in GitHub Desktop.
Save banjeremy/084cf240069a0e89519b362344cdbb6a to your computer and use it in GitHub Desktop.
get an age in years at a particular time (aka the years between two dates)
import com.github.nscala_time.time.Imports._
import org.joda.time.Years
def getAge(start: String, end: String): Int = {
Years.yearsBetween(
new DateTime(start),
new DateTime(end)
).getYears
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment