Jodatime start of day and end of day Jodatime start of day and end of day android android

Jodatime start of day and end of day


You can use the withTime method:

 d.withTime(0, 0, 0, 0); d.withTime(23, 59, 59, 999);

Same as Peter's answer, but shorter.


also a simple way is

d.millisOfDay().withMaximumValue();


How about:

private LocalDateTime calcNextSunday(LocalDateTime d) {    return d.withHourOfDay(23).withMinuteOfHour(59).withSecondOfMinute(59).withDayOfWeek(DateTimeConstants.SUNDAY);}private LocalDateTime calcPreviousMonday(final LocalDateTime d) {    return d.withHourOfDay(0).withMinuteOfHour(0).withSecondOfMinute(0).withDayOfWeek(DateTimeConstants.MONDAY);}