OffsetDateTime toEpochSecond()
converts this date-time to the number
of seconds from the epoch of 1970-01-01T00:00:00Z.
toEpochSecond
has the following syntax.
public long toEpochSecond()
The following example shows how to use toEpochSecond
.
import java.time.OffsetDateTime; 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.