Example usage for java.time Duration getSeconds

List of usage examples for java.time Duration getSeconds

Introduction

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

Prototype

public long getSeconds() 

Source Link

Document

Gets the number of seconds in this duration.

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.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.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.plus(4, ChronoUnit.DAYS);
    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.minus(3, ChronoUnit.DAYS);
    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);//from   ww  w.j  a  va 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.multipliedBy(2);

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

}

From source file:Main.java

public static void main(String[] args) {
    Duration duration = Duration.ofDays(33); //seconds or nanos

    Duration duration1 = Duration.ofHours(33); //seconds or nanos
    Duration duration2 = Duration.ofMillis(33); //seconds or nanos
    Duration duration3 = Duration.ofMinutes(33); //seconds or nanos
    Duration duration4 = Duration.ofNanos(33); //seconds or nanos
    Duration duration5 = Duration.ofSeconds(33); //seconds or nanos
    Duration duration6 = Duration.between(LocalDate.of(2012, 11, 11), LocalDate.of(2013, 1, 1));

    System.out.println(duration6.getSeconds());
    System.out.println(duration.getNano());
    System.out.println(duration.getSeconds());
}