Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Fields](https://developer.android.com/reference/java/time/chrono/JapaneseEra#lfields) \| [Methods](https://developer.android.com/reference/java/time/chrono/JapaneseEra#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/java/time/chrono/JapaneseEra#inhmethods)

# JapaneseEra


`
public

final

class
JapaneseEra
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


implements

https://developer.android.com/reference/java/time/chrono/Era,

https://developer.android.com/reference/java/io/Serializable


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | java.time.chrono.JapaneseEra |

<br />

*** ** * ** ***

An era in the Japanese Imperial calendar system.


The Japanese government defines the official name and start date of
each era. Eras are consecutive and their date ranges do not overlap,
so the end date of one era is always the day before the start date
of the next era.


The Java SE Platform supports all eras defined by the Japanese government,
beginning with the Meiji era. Each era is identified in the Platform by an
integer value and a name. The `https://developer.android.com/reference/java/time/chrono/JapaneseEra#of(int)` and `https://developer.android.com/reference/java/time/chrono/JapaneseEra#valueOf(java.lang.String)`
methods may be used to obtain a singleton instance of `JapaneseEra`
for each era. The `https://developer.android.com/reference/java/time/chrono/JapaneseEra#values()` method returns the singleton instances
of all supported eras.


For convenience, this class declares a number of public static final fields
that refer to singleton instances returned by the `https://developer.android.com/reference/java/time/chrono/JapaneseEra#values()` method.

## Summary

| ### Fields ||
|---|---|
| ` public static final https://developer.android.com/reference/java/time/chrono/JapaneseEra` | `https://developer.android.com/reference/java/time/chrono/JapaneseEra#HEISEI` The singleton instance for the 'Heisei' era (1989-01-08 - 2019-04-30) which has the value 2. |
| ` public static final https://developer.android.com/reference/java/time/chrono/JapaneseEra` | `https://developer.android.com/reference/java/time/chrono/JapaneseEra#MEIJI` The singleton instance for the 'Meiji' era (1868-01-01 - 1912-07-29) which has the value -1. |
| ` public static final https://developer.android.com/reference/java/time/chrono/JapaneseEra` | `https://developer.android.com/reference/java/time/chrono/JapaneseEra#REIWA` The singleton instance for the 'Reiwa' era (2019-05-01 - ) which has the value 3. |
| ` public static final https://developer.android.com/reference/java/time/chrono/JapaneseEra` | `https://developer.android.com/reference/java/time/chrono/JapaneseEra#SHOWA` The singleton instance for the 'Showa' era (1926-12-25 - 1989-01-07) which has the value 1. |
| ` public static final https://developer.android.com/reference/java/time/chrono/JapaneseEra` | `https://developer.android.com/reference/java/time/chrono/JapaneseEra#TAISHO` The singleton instance for the 'Taisho' era (1912-07-30 - 1926-12-24) which has the value 0. |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/time/chrono/JapaneseEra#getDisplayName(java.time.format.TextStyle,%20java.util.Locale)(https://developer.android.com/reference/java/time/format/TextStyle style, https://developer.android.com/reference/java/util/Locale locale) ` Gets the textual representation of this era. |
| ` int` | ` https://developer.android.com/reference/java/time/chrono/JapaneseEra#getValue()() ` Gets the numeric era `int` value. |
| ` static https://developer.android.com/reference/java/time/chrono/JapaneseEra` | ` https://developer.android.com/reference/java/time/chrono/JapaneseEra#of(int)(int japaneseEra) ` Obtains an instance of `JapaneseEra` from an `int` value. |
| ` https://developer.android.com/reference/java/time/temporal/ValueRange` | ` https://developer.android.com/reference/java/time/chrono/JapaneseEra#range(java.time.temporal.TemporalField)(https://developer.android.com/reference/java/time/temporal/TemporalField field) ` Gets the range of valid values for the specified field. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/time/chrono/JapaneseEra#toString()() ` Returns a string representation of the object. |
| ` static https://developer.android.com/reference/java/time/chrono/JapaneseEra` | ` https://developer.android.com/reference/java/time/chrono/JapaneseEra#valueOf(java.lang.String)(https://developer.android.com/reference/java/lang/String japaneseEra) ` Returns the `JapaneseEra` with the name. |
| ` static https://developer.android.com/reference/java/time/chrono/JapaneseEra` | ` https://developer.android.com/reference/java/time/chrono/JapaneseEra#values()() ` Returns an array of JapaneseEras. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||
| From interface ` https://developer.android.com/reference/java/time/chrono/Era ` |---|---| | ` default https://developer.android.com/reference/java/time/temporal/Temporal` | ` https://developer.android.com/reference/java/time/chrono/Era#adjustInto(java.time.temporal.Temporal)(https://developer.android.com/reference/java/time/temporal/Temporal temporal) ` Adjusts the specified temporal object to have the same era as this object. | | ` default int` | ` https://developer.android.com/reference/java/time/chrono/Era#get(java.time.temporal.TemporalField)(https://developer.android.com/reference/java/time/temporal/TemporalField field) ` Gets the value of the specified field from this era as an `int`. | | ` default https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/time/chrono/Era#getDisplayName(java.time.format.TextStyle,%20java.util.Locale)(https://developer.android.com/reference/java/time/format/TextStyle style, https://developer.android.com/reference/java/util/Locale locale) ` Gets the textual representation of this era. | | ` default long` | ` https://developer.android.com/reference/java/time/chrono/Era#getLong(java.time.temporal.TemporalField)(https://developer.android.com/reference/java/time/temporal/TemporalField field) ` Gets the value of the specified field from this era as a `long`. | | ` abstract int` | ` https://developer.android.com/reference/java/time/chrono/Era#getValue()() ` Gets the numeric value associated with the era as defined by the chronology. | | ` default boolean` | ` https://developer.android.com/reference/java/time/chrono/Era#isSupported(java.time.temporal.TemporalField)(https://developer.android.com/reference/java/time/temporal/TemporalField field) ` Checks if the specified field is supported. | | ` default <R> R` | ` https://developer.android.com/reference/java/time/chrono/Era#query(java.time.temporal.TemporalQuery<R>)(https://developer.android.com/reference/java/time/temporal/TemporalQuery<R> query) ` Queries this era using the specified query. | | ` default https://developer.android.com/reference/java/time/temporal/ValueRange` | ` https://developer.android.com/reference/java/time/chrono/Era#range(java.time.temporal.TemporalField)(https://developer.android.com/reference/java/time/temporal/TemporalField field) ` Gets the range of valid values for the specified field. | ||
| From interface ` https://developer.android.com/reference/java/time/temporal/TemporalAccessor ` |---|---| | ` default int` | ` https://developer.android.com/reference/java/time/temporal/TemporalAccessor#get(java.time.temporal.TemporalField)(https://developer.android.com/reference/java/time/temporal/TemporalField field) ` Gets the value of the specified field as an `int`. | | ` abstract long` | ` https://developer.android.com/reference/java/time/temporal/TemporalAccessor#getLong(java.time.temporal.TemporalField)(https://developer.android.com/reference/java/time/temporal/TemporalField field) ` Gets the value of the specified field as a `long`. | | ` abstract boolean` | ` https://developer.android.com/reference/java/time/temporal/TemporalAccessor#isSupported(java.time.temporal.TemporalField)(https://developer.android.com/reference/java/time/temporal/TemporalField field) ` Checks if the specified field is supported. | | ` default <R> R` | ` https://developer.android.com/reference/java/time/temporal/TemporalAccessor#query(java.time.temporal.TemporalQuery<R>)(https://developer.android.com/reference/java/time/temporal/TemporalQuery<R> query) ` Queries this date-time. | | ` default https://developer.android.com/reference/java/time/temporal/ValueRange` | ` https://developer.android.com/reference/java/time/temporal/TemporalAccessor#range(java.time.temporal.TemporalField)(https://developer.android.com/reference/java/time/temporal/TemporalField field) ` Gets the range of valid values for the specified field. | ||
| From interface ` https://developer.android.com/reference/java/time/temporal/TemporalAdjuster ` |---|---| | ` abstract https://developer.android.com/reference/java/time/temporal/Temporal` | ` https://developer.android.com/reference/java/time/temporal/TemporalAdjuster#adjustInto(java.time.temporal.Temporal)(https://developer.android.com/reference/java/time/temporal/Temporal temporal) ` Adjusts the specified temporal object. | ||

## Fields

### HEISEI

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final JapaneseEra HEISEI
```

The singleton instance for the 'Heisei' era (1989-01-08 - 2019-04-30)
which has the value 2.

<br />

### MEIJI

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final JapaneseEra MEIJI
```

The singleton instance for the 'Meiji' era (1868-01-01 - 1912-07-29)
which has the value -1.

<br />

### REIWA

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final JapaneseEra REIWA
```

The singleton instance for the 'Reiwa' era (2019-05-01 - )
which has the value 3. The end date of this era is not specified, unless
the Japanese Government defines it.

<br />

### SHOWA

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final JapaneseEra SHOWA
```

The singleton instance for the 'Showa' era (1926-12-25 - 1989-01-07)
which has the value 1.

<br />

### TAISHO

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final JapaneseEra TAISHO
```

The singleton instance for the 'Taisho' era (1912-07-30 - 1926-12-24)
which has the value 0.

<br />

## Public methods

### getDisplayName

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getDisplayName (TextStyle style, 
                Locale locale)
```

Gets the textual representation of this era.


This returns the textual name used to identify the era,
suitable for presentation to the user.
The parameters control the style of the returned text and the locale.


If no textual mapping is found then the `https://developer.android.com/reference/java/time/chrono/Era#getValue()` is returned.

<br />

| Parameters ||
|---|---|
| `style` | `TextStyle`: <br /> |
| `locale` | `Locale`: <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the text value of the era, not null <br /> |

### getValue

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getValue ()
```

Gets the numeric era `int` value.


The `https://developer.android.com/reference/java/time/chrono/JapaneseEra#SHOWA` era that contains 1970-01-01 (ISO calendar system) has the value 1.
Later eras are numbered from 2 (`https://developer.android.com/reference/java/time/chrono/JapaneseEra#HEISEI`).
Earlier eras are numbered 0 (`https://developer.android.com/reference/java/time/chrono/JapaneseEra#TAISHO`), -1 (`https://developer.android.com/reference/java/time/chrono/JapaneseEra#MEIJI`)).

<br />

| Returns ||
|---|---|
| `int` | the era value <br /> |

### of

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static JapaneseEra of (int japaneseEra)
```

Obtains an instance of `JapaneseEra` from an `int` value.

- The value `1` is associated with the 'Showa' era, because it contains 1970-01-01 (ISO calendar system).
- The values `-1` and `0` are associated with two earlier eras, Meiji and Taisho, respectively.
- A value greater than `1` is associated with a later era, beginning with Heisei (`2`).


Every instance of `JapaneseEra` that is returned from the `https://developer.android.com/reference/java/time/chrono/JapaneseEra#values()`
method has an int value (available via `https://developer.android.com/reference/java/time/chrono/Era#getValue()` which is
accepted by this method.

<br />

| Parameters ||
|---|---|
| `japaneseEra` | `int`: the era to represent <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/time/chrono/JapaneseEra` | the `JapaneseEra` singleton, not null <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/time/DateTimeException` | if the value is invalid |

### range

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ValueRange range (TemporalField field)
```

Gets the range of valid values for the specified field.


The range object expresses the minimum and maximum valid values for a field.
This era is used to enhance the accuracy of the returned range.
If it is not possible to return the range, because the field is not supported
or for some other reason, an exception is thrown.


If the field is a `https://developer.android.com/reference/java/time/temporal/ChronoField` then the query is implemented here.
The `ERA` field returns the range.
All other `ChronoField` instances will throw an `UnsupportedTemporalTypeException`.


If the field is not a `ChronoField`, then the result of this method
is obtained by invoking `TemporalField.rangeRefinedBy(TemporalAccessor)`
passing `this` as the argument.
Whether the range can be obtained is determined by the field.


The range of valid Japanese eras can change over time due to the nature
of the Japanese calendar system.

<br />

| Parameters ||
|---|---|
| `field` | `TemporalField`: the field to query the range for, not null <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/time/temporal/ValueRange` | the range of valid values for the field, not null <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/time/DateTimeException` | if the range for the field cannot be obtained |
| `https://developer.android.com/reference/java/time/temporal/UnsupportedTemporalTypeException` | if the unit is not supported |

### toString

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String toString ()
```

Returns a string representation of the object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | a string representation of the object. <br /> |

### valueOf

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static JapaneseEra valueOf (String japaneseEra)
```

Returns the `JapaneseEra` with the name.


The string must match exactly the name of the era.
(Extraneous whitespace characters are not permitted.)


Valid era names are the names of eras returned from `https://developer.android.com/reference/java/time/chrono/JapaneseEra#values()`.

<br />

| Parameters ||
|---|---|
| `japaneseEra` | `String`: the japaneseEra name; non-null <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/time/chrono/JapaneseEra` | the `JapaneseEra` singleton, never null <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if there is not JapaneseEra with the specified name |

### values

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static JapaneseEra[] values ()
```

Returns an array of JapaneseEras. The array may contain eras defined
by the Japanese government beyond the known era singletons.


This method may be used to iterate over the JapaneseEras as follows:

```
for (JapaneseEra c : JapaneseEra.values())
    System.out.println(c);
```

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/time/chrono/JapaneseEra` | an array of JapaneseEras <br /> |