All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hubspot.imap.protocol.command.search.DateSearches Maven / Gradle / Ivy

There is a newer version: 0.6.1
Show newest version
package com.hubspot.imap.protocol.command.search;

import com.hubspot.imap.protocol.command.search.keys.BeforeSearchKey;
import com.hubspot.imap.protocol.command.search.keys.SinceSearchKey;
import java.time.ZonedDateTime;

public class DateSearches {

  /**
   * Caveat: SEARCH BEFORE uses only date (no time) - you may get some surprising results on the boundaries
   * (which are exclusive)
   */
  public static SearchCommand searchBefore(ZonedDateTime d) {
    return new SearchCommand(new BeforeSearchKey(d));
  }

  /**
   * Caveat: SEARCH AFTER uses only date (no time) - you may get some surprising results on the boundaries
   * (which are exclusive)
   */
  public static SearchCommand searchAfter(ZonedDateTime d) {
    return new SearchCommand(new SinceSearchKey(d));
  }

  /**
   * Caveat: SEARCH BEFORE x AFTER y uses only date (no time) - you may get some surprising results on the boundaries
   * (which are exclusive)
   */
  public static SearchCommand searchBetween(ZonedDateTime start, ZonedDateTime end) {
    return new SearchCommand(new SinceSearchKey(start), new BeforeSearchKey(end));
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy