Close

Java Date Time - Instant.ofEpochSecond() Examples

Java Date Time Java Java API 


Class:

java.time.Instant

java.lang.Objectjava.lang.Objectjava.time.Instantjava.time.Instantjava.time.temporal.TemporalTemporaljava.time.temporal.TemporalAdjusterTemporalAdjusterjava.lang.ComparableComparablejava.io.SerializableSerializableLogicBig

Methods:

public static Instant ofEpochSecond(long epochSecond)

Obtains an instance of Instant using seconds from the epoch of 1970-01-01T00:00:00Z.


Examples


package com.logicbig.example.instant;

import java.time.Instant;

public class OfEpochSecondExample {

public static void main(String... args) {
Instant i = Instant.ofEpochSecond(7000000);
System.out.println(i);
}
}

Output

1970-03-23T00:26:40Z




See Also