Java LocalDate Between isBetween(LocalDate date, LocalDate before, LocalDate after)

Here you can find the source of isBetween(LocalDate date, LocalDate before, LocalDate after)

Description

is Between

License

Creative Commons License

Declaration

public static Boolean isBetween(LocalDate date, LocalDate before, LocalDate after) 

Method Source Code

//package com.java2s;
//License from project: Creative Commons License 

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;

public class Main {

    public static Boolean isBetween(LocalDate date, LocalDate before, LocalDate after) {
        return date.isAfter(before) && date.isBefore(after);
    }/*w  w  w .ja va 2 s  .c  om*/

    public static Boolean isBetween(LocalDateTime date, LocalDateTime before, LocalDateTime after) {
        return date.isAfter(before) && date.isBefore(after);
    }

    public static Boolean isBetween(LocalDateTime date, LocalDate before, LocalDate after) {
        return date.isAfter(before.atStartOfDay()) && date.isBefore(after.atTime(LocalTime.MAX));
    }

    public static Boolean isBetween(LocalDate date, LocalDateTime before, LocalDateTime after) {
        return date.isAfter(before.toLocalDate()) && date.isBefore(after.toLocalDate());
    }
}

Related

  1. daysBetween(LocalDate date1, LocalDate date2)
  2. daysBetween(LocalDate firstDate, LocalDate secondDate)
  3. getLocalDatesBetween(final LocalDate localDate1, final LocalDate localDate2)
  4. getRandomLocalDateBetween(int startYear, int endYear)
  5. isBetween13And18YearsBetween(LocalDate birthLocalDate, LocalDate now)
  6. isBetweenDates(LocalDate date, LocalDate start, LocalDate end)
  7. isBetweenIncl(@Nullable final LocalDate aDate, @Nullable final LocalDate aLowerBound, @Nullable final LocalDate aUpperBound)