I have some examples:
case1.
val date1 = new DateTime("2015-08-03T04:59:00.000")
output:
new DateTime("2015-08-03T04:00:00.000")
case2.
val date2 = new DateTime("2015-08-03T04:15:00.000")
output:
new DateTime("2015-08-03T04:00:00.000")
means for any datetime if the time is more the 1 minute output should be start of hour. Example for day: datetime.withTimeAtStartOfDay
.