Instant EPOCH example

Description

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;
/* ww w  .j a v  a 2  s . co  m*/
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.





















Home »
  Java Date Time »
    java.time Reference »




Clock
DayOfWeek
Duration
Instant
LocalDate
LocalDateTime
LocalTime
Month
MonthDay
OffsetDateTime
OffsetTime
Period
Year
YearMonth
ZonedDateTime
ZoneId
ZoneOffset