I need a method which returns a List of DateTime objects splitted by e.g hour
Example
DateTime start = DateTime.now() //2017-01-01 11:00:00
DateTime end = DateTime.now().plusHours(10) //2017-01-01 21:00:00
Expected Result
List[2017-01-01 **11**:00:00,2017-01-01 **12**:00:00,2017-01-01**13**:00:00...
2017-01-01 **21**:00:00]
Right now i am using workaround that i am not happy with
while(start.isBefore(end)){
start = startVar.plusHours(1)
//do something with start
}
Please, share your ideas.