OffsetDateTime toEpochSecond() example
Description
OffsetDateTime toEpochSecond()
converts this date-time to the number
of seconds from the epoch of 1970-01-01T00:00:00Z.
Syntax
toEpochSecond
has the following syntax.
public long toEpochSecond()
Example
The following example shows how to use toEpochSecond
.
import java.time.OffsetDateTime;
/*from ww w.j a v a 2 s . c o m*/
public class Main {
public static void main(String[] args) {
OffsetDateTime o = OffsetDateTime.MAX;
System.out.println(o.toEpochSecond());
}
}
The code above generates the following result.