LocalDateTime ofEpochSecond(long epochSecond, int nanoOfSecond, ZoneOffset offset)
gets an instance of LocalDateTime using seconds from the epoch of 1970-01-01T00:00:00Z.
ofEpochSecond
has the following syntax.
public static LocalDateTime ofEpochSecond(long epochSecond, int nanoOfSecond, ZoneOffset offset)
The following example shows how to use ofEpochSecond
.
import java.time.LocalDateTime; import java.time.ZoneOffset; /*from w ww. j a v a2 s . c o 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.