Skip to content

Instantly share code, notes, and snippets.

@swartzrock
Last active December 14, 2015 16:58
Show Gist options
  • Save swartzrock/5118602 to your computer and use it in GitHub Desktop.
Save swartzrock/5118602 to your computer and use it in GitHub Desktop.
Creating a list of DateTime's between two given dates based on an interval using List.tabulate()
val PRE_DST_DATE = "03/09/2013 19:00".toDateTime
val POST_DST_DATE = "03/10/2013 00:00".toDateTime
val interval = 15
val minutePeriods = Minutes.minutesBetween( PRE_DST_DATE, POST_DST_DATE ).getMinutes / interval
val datePeriods = List.tabulate[DateTime](minutePeriods)( minutes => PRE_DST_DATE.plusMinutes(minutes * interval) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment