Here you can find the source of isBetweenTimesInclusive(ZonedDateTime dateTime, ZonedDateTime startDateTime, ZonedDateTime endDateTime)
public static boolean isBetweenTimesInclusive(ZonedDateTime dateTime, ZonedDateTime startDateTime, ZonedDateTime endDateTime)
//package com.java2s; //License from project: Apache License import java.time.ZonedDateTime; public class Main { public static boolean isBetweenTimesInclusive(ZonedDateTime dateTime, ZonedDateTime startDateTime, ZonedDateTime endDateTime) { if (dateTime == null) return true; if (startDateTime == null) { if (endDateTime == null) {// Both startDate and endDate are null, so it's false return true; } else {// We only have the endDate, so any dateTime not after the endDateTime is true return !dateTime.isAfter(endDateTime); }/*www.j av a 2 s . c om*/ } else { if (endDateTime == null) {// We only have the startDateTime, so any dateTime not before the startDateTime is true return !dateTime.isBefore(startDateTime); } else {// We have both startDateTime and endDateTime, so any dateTime not before the startDate and not after endDateTime is true return !dateTime.isBefore(startDateTime) && !dateTime.isAfter(endDateTime); } } } }