Created
March 26, 2015 07:38
-
-
Save hamnis/08f52073d4281449d7bc to your computer and use it in GitHub Desktop.
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
def extractPartitionKey(duration: ReadablePeriod, now: DateTime = DateTime.now(DateTimeZone.UTC)): Seq[String] = { | |
val end = now.withZone(DateTimeZone.UTC) | |
val period = new Interval(duration, end) | |
val start = period.getStart | |
val fmt = ISODateTimeFormat.date() | |
val days = Days.daysBetween(start.withTimeAtStartOfDay(), end).getDays | |
for (d <- 0 to days) yield start.plusDays(d).toString(fmt) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment