Returns the number of seconds from the Java epoch of 1970-01-01T00:00:00Z.
package com.logicbig.example.instant;
import java.time.Instant;
public class GetEpochSecondExample {
public static void main(String... args) {
Instant i = Instant.now();
System.out.println(i);
long s = i.getEpochSecond();
System.out.println(s);
}
}
Output
2017-05-01T20:57:57.714Z
1493672277