Check if date is between two other dates

taijidude - Sep 18 - - Dev Community

A small method to check if a LocalDataTime is in a Range between to other LocalDateTime - Objects.

private boolean isInDateRange(
                        LocalDateTime upper,
                        LocalDateTime lower,
                        LocalDateTime toCheck) {
    var isUpper = toCheck.equals(upper);
    var isLower = toCheck.equals(lower);
    if (isLower || isUpper) {
        return true;
    }
    return toCheck.isBefore(upper) && toCheck.isAfter(lower);
}
Enter fullscreen mode Exit fullscreen mode
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player