LocalDate getEra() example

Description

LocalDate getEra() gets the era applicable at this date.

Syntax

getEra has the following syntax.


public Era getEra()

Example

The following example shows how to use getEra.


import java.time.LocalDate;
/* w  w w .ja va  2 s  .co m*/
public class Main {
  public static void main(String[] args) {
    LocalDate a = LocalDate.of(2014, 6, 30);

    System.out.println(a.getEra().getValue());
  }
}

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