Example usage for java.time Duration between

List of usage examples for java.time Duration between

Introduction

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

Prototype

public static Duration between(Temporal startInclusive, Temporal endExclusive) 

Source Link

Document

Obtains a Duration representing the duration between two temporal objects.

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.plusHours(4);/*from  w w w.  ja v a  2 s .  c om*/
    System.out.println(duration.getSeconds());

}

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.plusDays(4);/*from w  w  w  .jav a2  s .  c om*/
    System.out.println(duration.getSeconds());

}

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.plusMillis(4000);
    System.out.println(duration.getSeconds());

}

From source file:Main.java

public static void main(String[] args) {
    Duration duration = Duration.between(LocalTime.MIDNIGHT, LocalTime.NOON);
    System.out.println(duration.getNano());
    duration = duration.minusNanos(3);// w  w  w  . ja va 2s  .co  m
    System.out.println(duration.getNano());

}

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.minusMinutes(300);
    System.out.println(duration.getSeconds());

}

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:Main.java

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

}

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.withSeconds(1000);
    System.out.println(duration.getSeconds());
}

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.dividedBy(2);/* w  w w  .ja  v a  2 s  .co m*/

    System.out.println(duration.getSeconds());

}

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.multipliedBy(2);

    System.out.println(duration.getSeconds());

}