Skip to content

Instantly share code, notes, and snippets.

@servatj
Created February 25, 2019 15:33
Show Gist options
  • Save servatj/078eccd094df1e72730eccdd8169d694 to your computer and use it in GitHub Desktop.
Save servatj/078eccd094df1e72730eccdd8169d694 to your computer and use it in GitHub Desktop.
Scala function for getting a range of dates given a number of days.
val fullDate = DateTimeFormatter.ofPattern("yyyy-MM-dd")
val getDates = (days: Int) => {
val datesList = ListBuffer[String]()
var count: Int = 0;
for (i <- 1 to days) {
datesList += fullDate.format(LocalDate.now().minusDays(i))
}
datesList
}
val datesToProcess = getDates(193)
datesToProcess
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment