Skip to content

Instantly share code, notes, and snippets.

@samidalouche
Created March 5, 2014 22:39
Show Gist options
  • Save samidalouche/9378192 to your computer and use it in GitHub Desktop.
Save samidalouche/9378192 to your computer and use it in GitHub Desktop.
def bucketHourOpenClosed : joda.Interval = {
val hourTruncated = dateTime.withTime(dateTime.getHourOfDay, 0, 0, 0)
if(dateTime == hourTruncated){
new joda.Interval(dateTime.minusHours(1),dateTime)
} else {
new joda.Interval(hourTruncated,hourTruncated.plusHours(1))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment