Created
April 9, 2017 21:08
-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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