Created
February 25, 2019 15:33
-
-
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.
This file contains hidden or 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
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