Example usage for java.time OffsetDateTime minusMinutes

List of usage examples for java.time OffsetDateTime minusMinutes

Introduction

In this page you can find the example usage for java.time OffsetDateTime minusMinutes.

Prototype

public OffsetDateTime minusMinutes(long minutes) 

Source Link

Document

Returns a copy of this OffsetDateTime with the specified number of minutes subtracted.

Usage

From source file:Main.java

public static void main(String[] args) {
    OffsetDateTime o = OffsetDateTime.now();
    OffsetDateTime d = o.minusMinutes(120);
    System.out.println(d);//w w  w  . ja v  a2  s . com
}

From source file:org.openmhealth.dsu.controller.DataPointController.java

/**
 * A helper function for creating the DataPointSearchCriteria
 *
 * @param id the endUserId//from w w  w  . j a  va  2 s  .c  o m
 * @param namespace the namespace of the schema the data points conform to
 * @param name the name of the schema the data points conform to
 * @param version the version of the schema the data points conform to
 * @param createdOnOrAfter the earliest creation timestamp of the data points to return, inclusive
 * @param createdBefore the latest creation timestamp of the data points to return, exclusive
 * @return DataPointSearchCritera with the given parameters 
 **/
public DataPointSearchCriteria createSearchCriteria(String id, String namespace, String name, String version,
        OffsetDateTime createdOnOrAfter, OffsetDateTime createdBefore) {

    DataPointSearchCriteria res = new DataPointSearchCriteria(id, namespace, name, version);
    if (createdOnOrAfter != null && createdBefore != null) {
        res.setCreationTimestampRange(
                Range.closedOpen(createdOnOrAfter.minusMinutes(1), createdBefore.minusMinutes(1)));
    } else if (createdOnOrAfter != null) {
        res.setCreationTimestampRange(Range.atLeast(createdOnOrAfter.minusMinutes(1)));
    } else if (createdBefore != null) {
        res.setCreationTimestampRange(Range.lessThan(createdBefore.minusMinutes(1)));
    }
    return res;
}