Skip to content

Instantly share code, notes, and snippets.

@hcarvalhoalves
Created June 30, 2017 15:39
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 hcarvalhoalves/9f30effd27ab095710a83110582975cb to your computer and use it in GitHub Desktop.
Save hcarvalhoalves/9f30effd27ab095710a83110582975cb to your computer and use it in GitHub Desktop.
def coerceDate(dateFormat: String)(dateAsString: String) = {
val fmt = new java.text.SimpleDateFormat(dateFormat)
val dt = fmt.parse(dateAsString)
new java.sql.Date(dt.getYear, dt.getMonth, dt.getDay)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment