Java examples for java.time:LocalDateTime
Verify if the LocalDateTime is inside a period
//package com.java2s; import java.time.LocalDateTime; public class Main { /**//from w w w.ja va 2s . com * Verify if the data is inside a period * @param time * @param initialTime * @param finalTime * @return */ public static boolean isBetweenPeriod(LocalDateTime time, LocalDateTime initialTime, LocalDateTime finalTime) { if (time == null || initialTime == null || finalTime == null) return false; return time.isAfter(initialTime) && time.isBefore(finalTime); } }