Example usage for java.time Duration plusMinutes

List of usage examples for java.time Duration plusMinutes

Introduction

In this page you can find the example usage for java.time Duration plusMinutes.

Prototype

public Duration plusMinutes(long minutesToAdd) 

Source Link

Document

Returns a copy of this duration with the specified duration in minutes added.

Usage

From source file:Main.java

public static void main(String[] args) {
    Duration duration = Duration.between(LocalTime.MIDNIGHT, LocalTime.NOON);
    System.out.println(duration.getSeconds());
    duration = duration.plusMinutes(4000);
    System.out.println(duration.getSeconds());

}

From source file:com.vmware.vchs.base.DbaasApi.java

protected long getCycleAsSeconds(String cycle) {
    checkNotNull(cycle);// w w  w.  j ava2  s .  co m
    String[] cycleValues = cycle.split(":");
    int length = cycleValues.length;
    Duration seconds;
    if (length == 4) {
        Duration days = Duration.ofDays(Long.parseLong(cycleValues[length - 4]));
        Duration hours = days.plusHours(Long.parseLong(cycleValues[length - 3]));
        Duration minutes = hours.plusMinutes(Long.parseLong(cycleValues[length - 2]));
        seconds = minutes.plusSeconds(Long.parseLong(cycleValues[length - 1]));
    } else {
        throw new FailException("Invalid cycle value" + cycle);
    }
    return seconds.getSeconds();
}