LocalDateTime ofEpochSecond(long epochSecond, int nanoOfSecond, ZoneOffset offset) example
Description
LocalDateTime ofEpochSecond(long epochSecond, int nanoOfSecond, ZoneOffset offset)
gets an instance of LocalDateTime using seconds from the epoch of 1970-01-01T00:00:00Z.
Syntax
ofEpochSecond
has the following syntax.
public static LocalDateTime ofEpochSecond(long epochSecond, int nanoOfSecond, ZoneOffset offset)
Example
The following example shows how to use ofEpochSecond
.
import java.time.LocalDateTime;
import java.time.ZoneOffset;
/*from w w w .j av a2 s . co m*/
public class Main {
public static void main(String[] args) {
LocalDateTime a = LocalDateTime.ofEpochSecond(1,1,ZoneOffset.UTC);
System.out.println(a);
}
}
The code above generates the following result.