Example usage for java.time Instant getEpochSecond

List of usage examples for java.time Instant getEpochSecond

Introduction

In this page you can find the example usage for java.time Instant getEpochSecond.

Prototype

public long getEpochSecond() 

Source Link

Document

Gets the number of seconds from the Java epoch of 1970-01-01T00:00:00Z.

Usage

From source file:Main.java

public static void main(String[] args) {
    Instant instant = Instant.MIN;
    System.out.println(instant.getEpochSecond());

}

From source file:Main.java

public static void main(String[] args) {
    Instant i1 = Instant.now();

    long seconds = i1.getEpochSecond();
    System.out.println(seconds);// w ww  .  j  a v a 2  s .  c  o m
    int nanoSeconds = i1.getNano();
    System.out.println(nanoSeconds);
}

From source file:Main.java

public static void main(String[] args) {
    Instant instant = Instant.MAX;
    System.out.println(instant.getEpochSecond());

}

From source file:Main.java

public static void main(String[] args) {
    Instant instant = Instant.now();
    System.out.println(instant.getEpochSecond());

}

From source file:Main.java

public static void main(String[] args) {
    Instant instant = Instant.EPOCH;
    System.out.println(instant.getEpochSecond());

}

From source file:Main.java

public static void main(String[] args) {
    Instant instant = Instant.from(ZonedDateTime.now());
    System.out.println(instant.getEpochSecond());

}

From source file:Main.java

public static void main(String[] args) {
    Instant instant = Instant.ofEpochMilli(123123123123L);
    System.out.println(instant.getEpochSecond());

}

From source file:Main.java

public static void main(String[] args) {
    Instant instant = Instant.ofEpochSecond(123123123123L);
    System.out.println(instant.getEpochSecond());

}

From source file:Main.java

public static void main(String[] args) {
    Instant instant = Instant.parse("2014-12-03T10:15:30.00Z");
    System.out.println(instant.getEpochSecond());
}

From source file:Main.java

public static void main(String[] args) {
    Instant instant = Instant.now(Clock.systemDefaultZone());
    System.out.println(instant.getEpochSecond());

}