Java Date Time - Instant EPOCH example








Instant EPOCH defines the constant for the 1970-01-01T00:00:00Z epoch instant.

Syntax

EPOCH has the following syntax.

public static final Instant EPOCH

Example

The following example shows how to use EPOCH.

import java.time.Instant;

public class Main {
  public static void main(String[] args) {
    Instant instant = Instant.EPOCH;
    System.out.println(instant.getEpochSecond());
    
  }
}

The code above generates the following result.