Example usage for java.time ZonedDateTime isEqual

List of usage examples for java.time ZonedDateTime isEqual

Introduction

In this page you can find the example usage for java.time ZonedDateTime isEqual.

Prototype

default boolean isEqual(ChronoZonedDateTime<?> other) 

Source Link

Document

Checks if the instant of this date-time is equal to that of the specified date-time.

Usage

From source file:io.stallion.jobs.Schedule.java

/**
 * Returns true if this schedule matches the passed in datetime
 * @param dt//from   w w w .  j a va  2  s  .  co m
 * @return
 */
public boolean matchesDateTime(ZonedDateTime dt) {
    ZonedDateTime now = dt.withSecond(0).withNano(0);
    ZonedDateTime nextRun = nextAt(now).withSecond(0).withNano(0);
    if (now.isEqual(nextRun)) {
        return true;
    }
    return false;
}