Java Date Time Java Java API
java.time.Instant
public long getEpochSecond()
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); }}
2025-10-29T10:28:57.294Z1761733737